vendredi 1 juillet 2016

Linux Maven config - setting JAVA_HOME breaks Maven

I am attempting to setup a Maven-Tomcat build on Linux. Stepping through the configuration processes, I have encountered a problem.

As title says, setting the JAVA_HOME in .bashrc will break my Maven configurations.

Without JAVA_HOME set, Maven gives the following output for mvn -version:

Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_IE, platform encoding: UTF-8
OS name: "linux", version: "3.19.0-32-generic", arch: "i386", family: "unix"

However, once I set JAVA_HOME as any combination of the following:

#export JAVA_HOME=/usr/lib/jvm/
#export JAVA_HOME=/usr/lib/jvm/java-8-oracle
#export PATH=$PATH:$JAVA_HOME/bin

I am seeing the following output from mvn -version:

Error: JAVA_HOME is not defined correctly.
  We cannot execute /usr/lib/jvm//bin/java

It looks like there is an overlap in the path being set, somehow, somewhere.

Further to that affect - if I don't configure my JAVA_HOME in .bashrc, echo %JAVA_HOME returns empty. which java, however returns /usr/bin/java.

I've also gone the way of configuring /etc/environment as opposed to .bashrc but this returned the same results.

Any help on this is most appreciated, as I've been trying to fix for 2 days and feel like I am chasing my tail!

Aucun commentaire:

Enregistrer un commentaire