Share this page 

Detect if running in a 64bit JVMTag(s): Environment


public static boolean is64BitVM() {
  String bits = System.getProperty("sun.arch.data.model", "?");
  if (bits.equals("64") {
     return true;
  }
  if (bits.equals("?") {
     // probably sun.arch.data.model isn't available
     // maybe not a Sun JVM?
     // try with the vm.name property
     return 
        System.getProperty("java.vm.name")
           .toLowerCase().indexOf("64") >= 0;
    } 
  // probably 32bit
  return false;
  }
}