Tuesday, November 1, 2011

Install JDK 7 on Ubuntu Linux

Here is the step to install JDK 7 on Ubuntu Linux 11.10:

Download JDK7: http://www.oracle.com/technetwork/java/javase/downloads/index.html.

Follow the steps to Installation the JDK on Linux Platforms, http://download.oracle.com/javase/7/docs/webnotes/install/linux/linux-jdk.html.

1. Download the file. Before the file can be downloaded, you must accept the license agreement. The archive binary can be installed by anyone (not only root users), in any location that you can write to. However, only the root user can install the JDK into the system location.

2. Change directory to the location where you would like the JDK to be installed. Move the .tar.gz archive binary to the current directory.

3. Unpack the tarball and install the JDK.

$ tar zxvf jdk-7u<version>-linux-i586.tar.gz

The Java Development Kit files are installed in a directory called jdk1.7.0_<version> in the current directory.

4. Delete the .tar.gz file if you want to save disk space.

Finally, config your javac on Ubuntu Linux

In Terminal, type the command to install the java alternative.
$sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0/bin/javac 1

/usr/lib/jvm/ is the directory the JDK installed, on step 2; such that javac should be at /usr/lib/jvm/jdk1.7.0/bin/javac.
The last number, 1, is an integer of "priority"; it should be work on any integer number.

If you have more than one javac installed, type te comand to select the active javac.
$sudo update-alternatives --config javac

No comments:

Post a Comment