Saturday, July 7, 2012

OpenJDK on Linux Mint 13 - Part 2


Part 2: Installing & Configuring OpenJDK via GUI

This article outlines an alternative method of installing and configuring OpenJDK versions 6 and 7 using GUI programs instead of executing commands in a terminal. Choosing and installing the OpenJDK's will be carried out using the Synaptic Package Manager and switching between versions of OpenJDK will be done using the 'galternatives' utility. Note that the Synaptic Package Manager has been already installed as part of the standard packages during installation of Linux Mint 13 and does not have to be re-installed. The 'galternatives' utility, however, has to be installed. So, start up the Synaptic Package Manager (using Menu > Administration > Synaptic Package Manager) and type 'galternatives' into the search box as shown in the figure below and press Enter.



Click on the box besides the package name to select it and then press the Apply button. Press the Enter key at the confirmation screen that appears next. An installation status will then appear - close it when the installation is complete.

Next you need to choose and install the openjdk-6-jdk, openjdk-6-doc, openjdk-6-demo, openjdk-6-dbg, openjdk-7-jdk, openjdk-7-doc, openjdk-7-demo, and openjdk-7-dbg packages. Type 'openjdk' into the Synaptic's search box and press Enter. On the resulting screen as shown below, select all the packages mentioned previously. Then press the Apply button, followed by the Enter key to confirm the installation. Wait for the packages to be downloaded and installed - then close the installation status dialog box when completed.



Next you need to verify that both versions of OpenJDK has been installed using the 'galternatives' utility. To run the 'galternatives' utility, press Alt+F2 and the type galternatives into the box that appears. On the confirmation dialog box that appears next, type in the root password (galternatives requires root privilages) and press Enter. The galternatives utility will start as shown in the figure below.



Navigate to the 'Java' entry on the left-side and you will see a screen similiar to the one shown above. Note that the 64-bit version is shown in the figure - the 32-bit version will display 'i386' instead of 'amd64'. The version 6 of OpenJDK is the selected one at the moment. You can change the version to OpenJDK version 7 by clicking on the radio button under the 'Choice' column. Note that if you decide to use version 7, make sure that all the entries related to Java (normally preceeded by the letter 'j') on the left-hand side (for example; jar, jarsigner, javac ... etc) are selected and changed to version 7. The 'galternatives' utility makes switching between different OpenJDK versions easier by doing it in one place rather than having to run sudo update-alternatives --config xxxx (where xxxx is the item to be changed) for each and every Java related items on a terminal. Try switching between versions but remember to reset to OpenJDK version 6 once you have completed your tests.

No comments:

Post a Comment