linguistics, computers, and puns

JVM Upgrade for SmartOS

Tim Hammerquist February 03, 2013 #jvm #unix

Joyent's SmartOS is a great virtual hosting platform. I've used it to deploy Ruby on Rails apps and even a Yesod app with excellent performance and minimal fuss. If you haven't already, go check it out. I deployed a full Tomcat Java app server in less than 30 minutes, including download and configuration time.

The Tomcat 7.0 package that SmartOS has is great, but the JDK 6 is showing some wrinkles. Given my fully configured and running system, how simple is it to install an aftermarket JDK 7 and configure Tomcat to use it?

Pretty damn simple.


First, you'll need the JDK itself. You can download the packages directly from Oracle. Grab the package labeled "Solaris x86." Don't forget to accept Oracle's license agreement!

Because of the license hassle, I just downloaded the packages to my Linux workstation and scp'd them to the server.


Extract the tarballs to the system and (optionally) create a symlink for the new folder.

# cd /opt/local/java
# tar zxf $PATH_TO/jdk_7u13-solaris-i586.tar.gz
# ln -s jdk1.7.0_13 sun7

Note: these names may vary with the version of the JDK used.


Now you'll need to tell Tomcat to use the newly extracted JDK. Just add the following lines to in /opt/local/share/tomcat/bin, creating it if necessary:



Restart Tomcat.

# svcadm restart tomcat

To see the results, visit your server status page. If all is well, you should see the new JDK's version in the Server Information -> JVM Version section.

User-Mode Upgrade

Configuring your user to use the newly installed JDK isn't much different. If you use the bash shell, just add the following lines to your .bashrc:

export JAVA_HOME="/opt/local/java/sun7"
export PATH="$JAVA_HOME/bin:$PATH"

The settings will take effect on your next login.