JAVA JDK Installation For Linux/MAC Users
JAVA JDK Installation For Linux/MAC Users
http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-
138363.html
www.fastbitlab.com Page 1
STEP2: Installation for Linux users
1) Extract the tar file which you just downloaded.
www.fastbitlab.com Page 2
It is highly recommended that this JDK folder must be in the location
/usr/lib/jvm.
Note: Please use the appropriate path where you extracted the tar file. In my
case it is under the path “/home/kiran/java”.
2)
Now, in your machine java might have already installed or not installed, So
running the below command will show you the java version installed in your
machine, if no java is installed , then it will return “no alternatives “
Now you should see the new JDK listed and you can switch between the
alternatives with this command:
www.fastbitlab.com Page 3
Great! Now we have successfully installed the new version of the JAVA JDK.
But, it’s not sufficient. Now we have to change various environment variables.
For this you have to create one .sh file in the location
/etc/profile.d/myjavajdk.sh
sudo vi /etc/profile.d/myjavajdk.sh
export J2SDKDIR=/usr/lib/jvm/java_jdk_8/jdk1.8.0_121
export J2REDIR=/usr/lib/jvm/java_jdk_8/jdk1.8.0_121/jre
export
PATH=$PATH:/usr/lib/jvm/java_jdk_8/jdk1.8.0_121/bin:/usr/lib/jvm/java_jdk_8
/jdk1.8.0_121/db/bin:/usr/lib/jvm/java_jdk_8/jdk1.8.0_121/jre/bin
export JAVA_HOME=/usr/lib/jvm/java_jdk_8/jdk1.8.0_121/
export DERBY_HOME=/usr/lib/jvm/java_jdk_8/jdk1.8.0_121/db
The same file is available for download in the resource section. So you can
just download and put it under /etc/profile.d .
Great, now execute the below command to apply all these environmental
variable settings.
source /etc/profile.d/myjavajdk.sh.
www.fastbitlab.com Page 4
java -version
This must show the version of the latest java JDK installation you just did.
www.fastbitlab.com Page 5