I have Oracle jdk7 installed on my centos6. I noticed that the /etc/profile has the lines below:
#below lines are added for Java export JAVA_HOME="/usr/java/latest" ## export JAVA_HOME JDK ## export JAVA_HOME="/usr/java/jdk1.7.0_75"
In order to test my assumptions on env variables and PATHs, I commented all the lines above (the export lines). I tried to load the new
/etc/profile by sourcing it
. /etc/profile and issued the
echo $JAVA_HOME; it still returned the above path.
So, I rebooted the machine as the source didn't work. After the reboot, the
echo $JAVA_HOME returns nothing, which is expected. There is nothing in
~/.bash_profile for Java.
But if I issue the command:
java -version on the shell, it still returns
[root@localhost ~]# java -version java version "1.7.0_75" Java(TM) SE Runtime Environment (build 1.7.0_75-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
Where is the Java defined in the PATH? the path in the
~/.bash_profile is as below, it doesn't have any for Java.
# User specific environment and startup programs
PATH=$PATH:$HOME/bin export PATH ~ ~ ~
set - on the shell returns the line below for the PATH variable: