Multiple version JAVA in Ubuntu

Install JDK 8

sudo apt-get update ; sudo apt-get install openjdk-8-jre-headless
sudo  update-java-alternatives --list

to list off all the Java installations on a machine by name and directory, and then run

sudo  update-alternatives --config java

to choose which JRE/JDK to use.If you want to use different JDKs/JREs for each Java task, you can run can be configured (java, javac, javah, javaws, etc). And then

sudo  update-alternatives --config [javac|java|javadoc|etc.]

will associate that Java task/command to a particular JDK/JRE.

Advertisements