Sunday, June 28, 2009

Linux :: Installing & Configuring JDK on Linux

You have to install JDK, or you already have one set-up, but you want a newer version ??

Follow some simple steps below, no need to uninstall older one.

Download the package from SUN website, package name would be something like jdk-6u14-linux-x64-rpm.bin

Now change the permissions to make it executable :

chmod 755 jdk-6u14-linux-x64-rpm.bin

Then run it:
./jdk-6u14-linux-x64-rpm.bin

You will need to type yes to indicate your acceptance to their agreement and the installation will complete on its own. Unfortunately you are not yet done. Type java -version on the command line and you will see that it still points to the crappy old JVM from gcj.

You may locate the installation folder by following steps below:

Step 1:
updatedb;locate javac |grep bin

You will see an entry like this:
/usr/java/jdk1.6.0_14/bin/javac

Here /usr/java/jdk1.6.0_14 is the actual JAVA_HOME for your machine. Note this as you will need it to run the future commands.

Now run the alternatives command to instruct OS to recognize Sun's JVM.
alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_14/bin/java 100
alternatives --install /usr/bin/jar jar /usr/java/jdk1.6.0_14/bin/jar 100
alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_14/bin/javac 100

Finally you should configure alternative to use Sun's JVM as the default JVM. To do this type:
/usr/sbin/alternatives --config java

This will present you with at least 2 options. Choose the one for Sun's JVM. Similarly repeat the process for other commands.

Type java -version and you should see something like this:

java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-ea-b02)
Java HotSpot(TM) Client VM (build 1.6.0_14, mixed mode, sharing)


Bingo, now you are using the latest JDK version.

Cheers
@$H

No comments:

Post a Comment

The Azure Synapse Resource Provider Error

  If you are get the error " The Azure Synapse resource provider (Microsoft.Synapse) needs to be registered with the selected subscript...