I am very new in Ubuntu and I am lost about Environment Variable. I have read some Forums but I didn't understand yet.
If I type java -version
I got the java confirmation but if I type echo $JAVA_HOME
there is nothing or echo $PATH
there is nothing related to java.
In some forum I read to create /etc/profile.d/java.sh
file and add the export commands. Other one tells to edit /etc/environment
, other tells to add export commands in /etc/profile
and even other one tells to edit bash.bashrc
.
Currently, there is the java in my Ubuntu in /usr/lib/jvm/java-8-oracle/jre
and I am able to run some java tools (eg. Eclipse) but I am trying to add Maven and I am very confused how do the environment variables work in Ubuntu. I came from Windows and basically I would like to set these variables as simple as possible.
JAVA_HOME
isn't set. Maven takes it's location fromdefault.java
alternative. 2. Not the same. Everything in/etc
is system-wide and~/
is user-wide. I recommend you to placeJAVA_HOME
inside/etc/environment
unless custom user java home is required./etc/profile
directly. So/etc/profile.d/java.sh
or (as @Danatela suggested)/etc/environment
are proper places. – Gunnar Hjalmarsson Jul 14 '14 at 07:41