Jdk version

I am installing elsticsearch in the oracle linux 6.8
I set java version as hotspot by definig JAVA_HOME parameter in the .bash_profile file.
when i type (java -version) in terminal, output is as following
[srahimi@admin ~]$ java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

but when i used (sudo -i service elasticsearch start) command, following error has been shown:

Starting elasticsearch: the minimum required Java version is 8; your Java version from [/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.99.x86_64/jre] does not meet this requirement
[FAILED]

what is the matter?

When you run a command with sudo it runs as root. The root user probably has a different path defined in JAVA_HOME.

1 Like

i run the java -version command in root user and the result is hotspot

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.