Error: JAVA_HOME is not defined correctly executing maven

前端 未结 14 1572
时光说笑
时光说笑 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:35

    You might get this error due to couple of reasons. To fix this quickly please follow below steps,

    First find the java location. To get a list of your installed Java platforms, run the following command from the terminal:

    $ sudo update-alternatives --config java
    

    Now set JAVA_HOME and PATH,

    $ export JAVA_HOME=
    
    $ export PATH=$JAVA_HOME/jre/bin:$PATH
    

    Create the symlink

    $ sudo ln -s /jre 
    

    When we take your case as a example :

    $ sudo ln -s /usr/lib/jvm/java-7-oracle/jre /usr/lib/jvm/java-7-oracle/jre/bin/java
    

    Above command will create the symlink location where the system is trying to find in your issue.

    Finally do the

    $ mvn --version
    

提交回复
热议问题