How can I tell if the JVM in which my application runs is 32 bit or 64-bit? Specifically, what functions or properties I can used to detect this within the program?
Just type java -version
in your console.
If a 64 bit version is running, you'll get a message like:
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)
A 32 bit version will show something similar to:
java version "1.6.0_41"
Java(TM) SE Runtime Environment (build 1.6.0_41-b02)
Java HotSpot(TM) Client VM (build 20.14-b01, mixed mode, sharing)
Note Client
instead of 64-Bit Server
in the third line. The Client/Server
part is irrelevant, it's the absence of the 64-Bit
that matters.
If multiple Java versions are installed on your system, navigate to the /bin folder of the Java version you want to check, and type java -version
there.