Tuesday, 4. September 2007
How To Check for the Java Version in an Ubuntu System
The Caffeine Coder has a few tips for Ubuntu users who work with Java. Ubuntu comes with a version of Java (jgc) that is not from the Sun Microsystems' stable. If you are developing Java applications, it is recomended you install the Sun JDK, by browsing through the package manager to identify the Sun JDK and pick your version of choice.
The Java system, however, may not fully utilise the JDK. To work around this, the first step is to find out the current version in use, by checking the Java version in a terminal session to know which version you installed from the package manager. Next run
sudo update-alternatives –config java in the terminal, which will display a list of the installed Java versions (an * will be displayed against the current one in use). You can pick the version you want to use from this list or accept the current default and that will now become the default Java version for Ubuntu.
This tip is also handy if you want to check you application in different versions of Java, develop to a specific version, and also switch to a different version to trobleshoot the Java environment related issues.