Monday, September 18, 2017

UBUNTU Setup JAVA HOME

UBUNTU Setup JAVA HOME


System-wide environment variables

/etc/profile.d/*.sh

Files with the .sh extension in the /etc/profile.d directory get executed whenever a bash login shell is entered (e.g. when logging in from the console or over ssh), as well as by the DisplayManager when the desktop session loads.
You can for instance create the file /etc/profile.d/myenvvars.sh and set variables like this:  
Suppose my jdk1.7.0 in folder /home/approved/Downloads

sudo -i
(type password)
cat >/etc/profile.d/myenvvars.sh
(and press)
export JAVA_HOME=/home/approved/Downloads/jdk1.7.0 
export PATH=$PATH:$JAVA_HOME/bin
(and press)
Ctrl+D

logout 
in terminal: 
java -version 


download file now