Switch between Java version on Ubuntu

My current project runs on Java 7 and I wanted to test the same project in Java 8. My first step was to install Java 8 on my Ubuntu system. After installing Java 8 now it’s time to test my application. All went successful and now I have to switch back to Java 7 since my current development environment uses Java 7. I was stuck when searching on google on how to switch back to Java 7. In this article we would learn how we can switch over multiple Java version on Ubuntu systems.

Switching between multiple Java version can be accomplished using “update alternatives” command. To get the current list of Java installed on your Ubuntu system we execute the following command.

After executing the above command it would list down all the Java version installed.

After selecting the appropriate version Ubuntu will automatically switch between Java version.

Note: Any changes made in JAVA_HOME inside bashrc should be made manually.

Tagged , . Bookmark the permalink.

Comments are closed.