DevOps Zone is brought to you in partnership with:

David is a systems architect who has been developing software professionally since 1991. He started programming in Java way back with Java 1.0 developing desktop applications and applets. Since 2001 he has been developing enterprise applications using both Java standards and open source solutions. David is the author of "Building SOA-Based Composite Applications using NetBeans 6" and "Seam 2.x Web Development". David is a DZone MVB and is not an employee of DZone and has posted 22 posts at DZone. You can read more from them at their website. View Full User Profile

Choosing a Java Version on Ubuntu

04.05.2013
| 4157 views |
  • submit to reddit

When you have got multiple versions of Java installed, you can choose which one you want to use by running the update-alternatives command.

Running this command shows a list of installed Java JDKs and JREs allowing one to be selected as the default that is used when java needs to be executed.

sudo update-alternatives --config javac

If you prefer to use a gui instead of the command line, you can execute galternatives instead and define the default versions of software with the following dialog.

sudo galternatives

Published at DZone with permission of David Salter, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)