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_HOMEisn't set. Maven takes it's location fromdefault.javaalternative. 2. Not the same. Everything in/etcis system-wide and~/is user-wide. I recommend you to placeJAVA_HOMEinside/etc/environmentunless custom user java home is required./etc/profiledirectly. So/etc/profile.d/java.shor (as @Danatela suggested)/etc/environmentare proper places. – Gunnar Hjalmarsson Jul 14 '14 at 07:41