Error: JAVA_HOME is not defined correctly executing maven

前端 未结 14 1546
时光说笑
时光说笑 2020-11-28 05:50

I installed java and set path to environment and when I execute echo $JAVA_HOME I get the following output:

/usr/lib/jvm/java-7-oracle/jre/bin/j         


        
14条回答
  •  借酒劲吻你
    2020-11-28 06:38

    Firstly, in a development mode, you should use JDK instead of the JRE. Secondly, the JAVA_HOME is where you install Java and where all the others frameworks will search for what they need (JRE,javac,...)

    So if you set

    JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre/bin/java

    when you run a "mvn" command, Maven will try to access to the java by adding /bin/java, thinking that the JAVA_HOME is in the root directory of Java installation.

    But setting

    JAVA_HOME=/usr/lib/jvm/java-7-oracle/

    Maven will access add bin/java then it will work just fine.

提交回复
热议问题