Jdk version

(sahere rahimi) #1

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-] does not meet this requirement

what is the matter?

(John Strömblom) #2

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

(sahere rahimi) #3

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