HOW WE TELL PROGRAMMATICALLY IF I'M RUNNING IN 64-BIT JVM OR 32-BIT JVM

How can I tell if the JVM my application runs in is 32 bit or 64-bit? Specifically, what function or preference do I access to detect this within the program?
Last updated:8/12/2015 6:29:31 AM

1 Answers

Mayank Tripathi
Mayank Tripathi

Sun has a Java System property to determine the bitness of the JVM: 32 or 64:

sun.arch.data.model=32 // 32 bit JVM
sun.arch.data.model=64 // 64 bit JVM
You can use

System.getProperty('sun.arch.data.model') 
to determine if its 32/64 from the program.

Answer