Monday, July 9, 2012

Determine whether Java version is 32-Bit or 64-Bit

Sun Java has provided a System property to determine whether installed version supports 32-Bit or 64 Bit named "sun.arch.data.model".


sun.arch.data.model=32 // 32 bit JVM
sun.arch.data.model=64 // 64 bit JVM
Try the following in your Java program: System.out.print(System.getProperty("sun.arch.data.model")) ; Other option is on command line use the following command, it will give you the details about the version and Bits:
java - version





C:\>java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)

No comments: