Step 1 : Check the already installed JAVA in Linux.
Step 2: Command >> java -version
[in my case -- java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (rhel-1.45.1.11.1.el6-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode) ]
Step 3: Command >> which java
[ /usr/bin/java - in all linux its same - its bin file for java ]
Step 4: Command >> cd /usr/lib/jvm
[ to check libraries of already installed java ]
Step 5: Download new JAVA from oracle
Use this Link: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
jdk-8u121-linux-x64.tar.gz
Step 6: move this file to /usr/lib/java/ location {optional}
command >> mv jdk-8u121-linux-x64.tar.gz /usr/lib/java
Step 7: command to extract >> tar -xvzf jdk-8u121-linux-x64.tar.gz
Step 8: Command >>
update-alternatives --install "/usr/bin/java" "java" /usr/lib/java/jdk1.8.0_121/bin/java 1
[where,
/usr/bin/java -- its bin file for java to install
/usr/lib/java/jdk1.8.0_121/bin/java -- New JDK bin
1 is for priority ]
Step 9: Command >> update-alternatives --set java /usr/lib/java/jdk1.8.0_121/bin/java
Step 10: check the version command >> java -version
Step 11 : command >> whereis java
Using alternatives, check if changes have taken effect and finally confirm the java version on system.
Step 12 : command >> alternatives --config java
---------------------------------------------------------------------------------------------------------------
[You can also change the selection of java in System]
Output:
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
2 /java/jdk1.8.0_121/bin/java
+ 3 /usr/lib/java/jdk1.8.0_121/bin/java
Enter to keep the current selection[+], or type selection number:
Reference DOC link: https://access.redhat.com/solutions/1161843
Thanks to all.
No comments:
Post a Comment