Skip to content
Advertisement

error JAVA_HOME is not defined correctly

When Ii run command mvn spring-boot:run, I got error:

JAVA_HOME is not defined correctly.
We cannot execute /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64/bin/java

when I check above path java-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64 is not exist.

My java version is:

openjdk version "1.8.0_161"

I check JAVA_HOME in /etc/environment

export JAVA_HOME=/usr/java/jdk1.8.0_131/jre

Is it because of different version in JAVA_HOME I got the error? I try to change the JAVA_HOME path to other version but still got same error. I’m using centos 7.

Advertisement

Answer

problem solved when i run this command

export JAVA_HOME=$(/usr/libexec/java_home)
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement