1. Skip to Menu
  2. Skip to Content
  3. Skip to Footer>
Saturday May 18th     6:45 PM PDT                                  

Upgrading JAVA

PDF Print E-mail

Written by Greg King Saturday, 26 January 2013 00:00

DISCLAIMER! This document is nothing more than the musings of the author as he attempts to perform the stated tasks.  Conclusions and approaches
may very well be incorrect, inefficient, or otherwise outside of professionally accepted best practices. Use this document at your own risk! In this
document, screen outputs will be presented in green. Where keyboard input is required, the prompt will be in bolded red. # means you should be at the
super user prompt, $ means you should be at an
user prompt. Do not include these prompts in your input! The command to be typed will be
shown in blue.
# ls -al
means you type ls -al at the super user prompt.
Fortunately for us, Oracle makes it very easy to upgrade the version of Java we are using in Solaris.  All we have to do is put the new version in the correct location, modify a symbolic link, and we are done.

You can get the latest Java Developer's Kit by simply googling "Solaris Java JDK".  Ensure you get the Solaris version appropriate for your architecture (we use SPARC in this example).  In the OBTAINING SOFTWARE section of this blog there is a link to the 7u11 version which is current as of this writing.

Once you have the tar.gz, gunzip it, and then tar -xf <filename>

You will end up with a directory like jdk1.7.0_11

What we are going to do now is simply move the directory to the proper area (/usr/jdk/instances), and remove and recreate two symbolic links the system uses to find java.  We have to recreate them so they point to the new version we are going to run.

# cd /usr/jdk/instances
# mv -r <source directory of your files> .
# chown -R root:bin jdk1.7.0_11

# cd ..
# ln -s instances/jdk1.7.0_11 jdk1.7.0_11
# rm latest
# ln -s jdk1.7.0_11 latest
# cd ..
# rm java
# ln -s
jdk/jdk1.7.0_11 java
# java -version

java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) Server VM (build 23.6-b04, mixed mode)

I use the 'latest' symbolic link, which points to the version I want to run, to avoid having to continually delete and edit symbolic links as I upgrade.

After a while, if you are comfortable with the version you are running, you can delete older versions out of the /usr/jdk/instances directory

Thanks all there is to it!

NOTE: If you have a stable NAS, it makes sense to install the java binaries in a jdk directory on the nas.  You then point your symbolic links on the local system(s) to the /<nas>/jdk/latest file which is a symbolic link to the binaries stored on the nas.  This allows you to update your java system on all systems without actually touching each one!

So far, I've noticed that JDK 7u11 breaks the Solaris Management Console 2.1.  I can live without that, but will keep an eye out for other breakage.

  Solaris Lab
eXTReMe Tracker
Content View Hits : 406687