64-bit JRE’s on Solaris

It is always interesting to run into JVM issues on Solaris servers which you think would just work.  If you’re used to working in Linux, a simple java -version would suffice, but if you look at the same output from a JRE on a Solaris box you may encounter the similar output like so

bash$ $JAVA_HOME/bin/java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)

and you might ask is that 32-bit or 64-bit?  Doing a file $JAVA_HOME/bin/java will definatively tell you the version, but on a Solaris box, it may be 32-bit and you will probably want 64-bit.

bash$ file $JAVA_HOME/bin/java
/opt/java/jre1.6.0_21/bin/java: ELF 32-bit MSB executable SPARC 
Version 1, dynamically linked, not stripped, no debugging 
information available

All you need to do is:

  1. Install the version of the 32-bit JRE that you desire
  2. Then install the 64-bit version right on top of it, in the same directory.

Notice the 64-bit installer unpacks some binaries in sparcv9 directories, and the 64-bit version of the JVM can now be seen in

bash$ file $JAVA_HOME/bin/sparcv9/java
/opt/java/jre1.6.0_21/bin/sparcv9/java: ELF 64-bit MSB executable 
SPARCV9 Version 1, dynamically linked, not stripped, no debugging 
information available

All that needs to be done after that is adding is to add the -d64 flag to your $JAVA_OPTIONS and you can use $JAVA_HOME/bin/java normally. You can just run it directly with the flag to confirm:

bash$  $JAVA_HOME/bin/java -version -d64
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) 64-Bit Server VM (build 17.0-b16, mixed mode)
Advertisements
This entry was posted in Java, Solaris. Bookmark the permalink.

2 Responses to 64-bit JRE’s on Solaris

  1. Kylia says:

    Big help, big help. And surpleative news of course.

  2. nap says:

    I’m glad you found it useful!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s