Having JAVA_HOME inconsistency issue with maven

依然范特西╮ 提交于 2019-12-03 07:08:30

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

export JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre

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

Another workaround:

export JAVACMD=$JAVA_HOME/bin/java

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

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.

in super user privilege on your terminal open

vi etc/environment

on opened file add JAVA_HOME path

JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386/"

Hope you set the JAVA_HOME check if your JAVA_HOME is set using command

echo $JAVA_HOME

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

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!