Last active
January 16, 2017 09:13
-
-
Save sujaykumarh/fa529e259cd28b85210cef83a6b4814b to your computer and use it in GitHub Desktop.
JDK Setup for LINUX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============================================= IMPORTANT ========================================= | |
$ means these commands needs to be executed in terminal and '$' should not be typed | |
================================================================================================= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reference commands | |
$ sudo alternatives --install /usr/bin/$(var) $(var) /path-to-jdk/jdk-ver/bin/$(var) 1000 | |
$ sudo alternatives --config $(var) | |
---- replace $(var) with each of these | |
java | |
javac | |
javadoc | |
javaws | |
---- to check JDK version | |
$ java -version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXAMPLE to set JDK 7 in path /opt/JDK_7 | |
$ sudo alternatives --install /usr/bin/java java /opt/JDK_7/bin/java 1000 | |
$ sudo alternatives --install /usr/bin/javac javac /opt/JDK_7/bin/javac 1000 | |
$ sudo alternatives --install /usr/bin/javadoc javadoc /opt/JDK_7/bin/javadoc 1000 | |
$ sudo alternatives --install /usr/bin/javaws javaws /opt/JDK_7/bin/javaws 1000 | |
After setup of alternatives, To configure Java execute and select appropriate version of your choice | |
$ sudo alternatives --config java | |
$ sudo alternatives --config javac | |
$ sudo alternatives --config javadoc | |
$ sudo alternatives --config javaws | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment