Links

Friday, September 24, 2010

Upgrading Java version (JDK) in Solaris

I'm going to show you how to up-grade your java version in Solaris 10..
First of all, check your current version

root@u10 # java -version
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)
root@u10 #
Here, we can see that the java version in my box is 1.5.0_07

We want to up-grade the latest version. You can get the latest version from here. In this tutorial, I'm going to up-grade the java into 6update3. The file named jdk-6u3-solaris-sparc.tar.Z


Unzip the file in any folder (/tmp for example)

root@u10 # gunzip jdk-6u3-solaris-sparc.tar.Z
It will create the gunzip jdk-6u3-solaris-sparc.tar
Untar the file

root@u10 # tar xvf jdk-6u3-solaris-sparc.tar
The result :

root@u10 # ls
COPYRIGHT SUNWj6rt
LICENSE SUNWjavadb-client
README.html SUNWjavadb-common
SUNWj6cfg SUNWjavadb-core
SUNWj6dev SUNWjavadb-demo
SUNWj6dmo SUNWjavadb-docs
SUNWj6jmp SUNWjavadb-javadoc
SUNWj6man

Add the package

root@u10 # pkgadd -d /tmp

Solaris will perform the package installation. Just follow all the steps.
After that check the /usr/jdk folder

root@u10 # cd /usr/jdk
root@u10 # lsinstances jdk1.5.0_07 latest
j2sdk1.4.2_12 jdk1.6.0_03 packages

You'll see the new folder named jdk1.6.0_03. That's the new folder Solaris made after the pkgadd command.
In Solaris, java reside in /usr/java
Change your directory to /usr

root@u10 # cd /usr
root@u10 # ls -ltr java
lrwxrwxrwx 1 root other 15 Sep 12 21:48 java -> jdk/jdk1.5.0_07

As you can see, /usr/java is a link to /usr/jdk/jdk1.5.0_07 folder. Remember the current version of java.. That's right, 1.5.0_07 is the current version.
Next step is, change the link destination to /usr/jdk/jdk1.6.0_03

root@u10 # rm java (remove the current link)
root@u10 # ln -s jdk/jdk1.5.0_03 java (create new link)
root@u10 # ls -ltr java
lrwxrwxrwx 1 root root 15 Nov 28 22:35 java -> jdk/jdk1.6.0_03

The link has been created.
And the step, check your current java version

root@u10 # java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

No comments:

Post a Comment

Search This Blog