Skip to main content

Posts

Showing posts from December, 2020

Multiple JDK on Windows

 Installation of JDK is straight forward for Windows, just download JDK and install. There are situation where certain type of program require specific version of JDK and JRE. In such case you will have more then one version of JDK installed on your machine and you will have to switch JDK version based on the need of the program.  Configure Java Set up System Environment variable JAVA_HOME = C:\Program Files\Java\jdk-11.0.8\bin In Path variable append extra entry for JAVA_HOME Path = %JAVA_HOME% Check environment variable and Java in cmd echo %JAVA_HOME%  java -version Switch JDK   Just edit the JAVA_HOME system variable and point to new JDK location. You don't have to change Path variable. JAVA_HOME = C:\Program Files\Java\jdk-1.8\bin

Installing JDK on MacOS

Check the version of JDK installed and the path on your MacOS /usr/libexec/java_home -V Check this instance/version of the JDK is currently running on your MacOS java --version The above command will show the currently used JDK and JRE If you have multiple instances of JDK installed on your MacOS and want to switch the version based on the required environment. You can do so by following the below steps: Edit ~/.bash_profile and set JAVA_HOME environment variable export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) In case of MacOS BigSur export JAVA_HOME=$(/usr/libexec/java_home -v 1.8.0)  The above command will switch the JDK version to 1.8 Reload the changes to the environment source ~/.bash_profile

Installing JDK on Ubuntu

  OpenJDK To install Open JDK 11 LTS sudo apt-get install openjdk-11-jdk or  sudo apt install default-jdk Oracle JDK For Oracle JDK you have to manually download from the Oracle JDK website and install it. PPA doesn't work well anymore. Manage JAVA   If you have multiple JDK on your machine, you can configure which version to be used using the following command by selecting one. sudo update-alternatives --config java