Question

I have installed Maven on Ubuntu 12.04. The following is the output when I do

$ mvn --version

Listening for transport dt_socket at address: 8787
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.6.0_38, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/jdk1.6.0_38/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-52-generic", arch: "amd64", family: "unix"

but when I do

$ gedit /etc/environment

the output is

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" 

also the .bash_rc does not have any entry for JAVA_HOME and there is no .bash_profile file.

My Question

If JAVA_HOME is not set how mvn --version is showing a value of it?

Was it helpful?

Solution

If JAVA_HOME is not set how mvn --version is showing a value of it?

On my system, the mvn program is a shell script, which performs various operations to try to guess a value for JAVA_HOME, if a value is not already set. In particular, it examines the location of the javac program.

However, according to the answer of a related question, what mvn reports as "Java home" is not the value of the JAVA_HOME environment variable: it is the value of the java.home system proeprty

OTHER TIPS

Can be set in /etc/.bash_profile or other system rc files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top