As you all know, all the modern CPU models are all 64-bit. The software we use on a such machine could be 32-bit or 64-bit. In a 32-bit operating system (OS) you can only install 32-bit software, so you can only have 32-bit JDK. In a 64-bit OS you can install 32-bit and/or 64-bit software.
There are still a few platforms that are only compatible with 32-bit JDK, like the HP OpenCall Convergent Communication Platform that I am working with. HP has almost ready the 64-bit release, but this is another story.
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:
$> java -d64 -version Running a 64-bit JVM is not supported on this platform
$> 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 (thanks to Petros catch).
Democracy Requires Free Software