简体   繁体   中英

How to manage different versions of Java in Ubuntu

How to manage different versions of Java in Ubuntu 14.04 like the way we use RVM for managing ruby versions? It is currently difficult to manage projects running on different versions of java.

sudo update-alternatives --remove-all java
(optional if you want to start fresh)
-----> This would remove all pre-existing alternatives.

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8-oracle/bin/java priority
( priority could be the version number)
-----> This would create an alternative, you could add one for each version of java.

sudo update-alternatives --config java
-----> To select the alternative version you wish to use.

When you do this it will give you a list of Java versions to choose from , you choose based on the version number.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM