Skip to content

Instantly share code, notes, and snippets.

@sujaykumarh
Last active January 16, 2017 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sujaykumarh/fa529e259cd28b85210cef83a6b4814b to your computer and use it in GitHub Desktop.
Save sujaykumarh/fa529e259cd28b85210cef83a6b4814b to your computer and use it in GitHub Desktop.
JDK Setup for LINUX
============================================= IMPORTANT =========================================
$ means these commands needs to be executed in terminal and '$' should not be typed
=================================================================================================
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
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