Skip to content

How can I tell if I'm running in 64-bit JVM or 32-bit JVM (from within a program)?

To determine whether you are running in a 64-bit JVM or a 32-bit JVM from within a Java program, you can use the sun.arch.data.model system property. This property returns "32" if you are running in a 32-bit JVM, and "64" if you are running in a 64-bit JVM.

Here's an example:

java
String arch = System.getProperty("sun.arch.data.model");
if (arch != null && arch.equals("64")) {
    // running in a 64-bit JVM
} else {
    // running in a 32-bit JVM
}

Note that while sun.arch.data.model is a non-standard, Sun/Oracle-specific property, it remains the most reliable de-facto standard for detecting JVM bitness.

Dual-run preview — compare with live Symfony routes.