1
votes

When I run echo "Maven is on versionmvn -v", the following error occurs:

Error: JAVA_HOME is not defined correctly. We cannot execute /usr/lib/jvm/java-8-oracle/bin/java Maven is on version

I tried different solutions explained in other threats, however none worked so far:

I set JAVA_HOME (/usr/lib/jvm/java-8-openjdk-amd64/jre) in the following places /etc/profile.d/jdk.sh, etc/enviroment, bashrc.

echo $JAVA_HOME gives:

/usr/lib/jvm/java-8-openjdk-amd64/jre

echo $PATH outputs:

/usr/lib/jvm/java-8-openjdk-amd64/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

So, I cannot figure out why Maven version checking points to inexisting folder /usr/lib/jvm/java-8-oracle/bin/java.

1

1 Answers

0
votes

You can set the JAVA_HOME through the below commands

JAVA_HOME=jdk-install-dir
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH 

I get this from Oracle page.