Having JAVA_HOME inconsistency issue with maven

后端 未结 7 2151
春和景丽
春和景丽 2021-02-08 11:32

I am on the verge of releasing a project but it seem JAVA_HOME is been inconsistent. Maybe it\'s been overridden somewhere else? I am using ubuntu 14.04 and I have openjdk-7, ja

相关标签:
7条回答
  • 2021-02-08 11:38

    JAVA_HOME must point to jre, not jdk. Then set :

    export JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre
    
    0 讨论(0)
  • 2021-02-08 11:39

    Another workaround:

    export JAVACMD=$JAVA_HOME/bin/java
    

    setting /usr/lib/jvm/java ⇒ /usr/java/jdk1.7.0_45 did not work for me

    0 讨论(0)
  • 2021-02-08 11:43

    I spend quite some time to tackle similar error. It looks like package manager might create mess in Java installations. Path to Java is sometimes hardcoded in bash files. I found one in /etc/profile.d/jdk.sh. It just overrides your settings. Another fix/workaround for that is to update symlink, in my case it was /usr/lib/jvm/java ⇒ /usr/java/jdk1.7.0_45. Try to look for java/bin text in all bash files.

    0 讨论(0)
  • 2021-02-08 11:43

    I had the same problem. My workaround was:

    cd /usr/lib/jvm/java-8-oracle/jre/bin
    sudo ln -s /usr/lib/jvm/java-8-oracle/bin/java java
    
    0 讨论(0)
  • 2021-02-08 11:44

    I used OpenJDK as default java , updated JAVA_HOME in /etc/environment and all the issues went. Thanks for all your effort helping me through this

    0 讨论(0)
  • 2021-02-08 11:46

    Creating a file .mavenrc on my home folder and adding the code below solved the problem for me. (Ubuntu 14.10, Maven 3.2.1)

    export JAVA_HOME=/usr/lib/jvm/java-8-oracle
    
    0 讨论(0)
提交回复
热议问题