Wednesday, April 9, 2014

Java software installed is 32 bit or 64 bit?

There are times that you login to a server with an already installed JDK and you have to know if this is a 32-bit or a 64-bit JDK.
My recommended procedure to find it out is to run in a CLI this command:
$> java -d64 -version
You can run this command on 32-bit and 64-bit JDKs, but it produces different result, where you can understand which kind of JDK you are using.
 

Here is a sample output:
32-bit JDK
$java -d64 -version Running a 64-bit JVM is not supported on this platform
 
64-bit JDK
$java -d64 -version java version "1.6.0_31" Java(TM) SE Runtime Environment (build 1.6.0_31-b05) Oracle JRockit(R) (build R28.2.3-13-149708-1.6.0_31-20120327-1523-linux-x86_64, compiled mode)

When you running it on a 32-bit JDK, the command is not supported, so you get an error message. While when running it on 64-bit JDK you get the information of the installed JDK.
This method works both with HotSpot and JRockit JVMs, but it is only supported on Linux and Solaris.

No comments:

Post a Comment