检测 Java 是否运行在64bit 的JVM上的方法

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

1
2
3
4
5
6
7
8
9
10
11
public static boolean is64BitVM() { 
   String bits = System.getProperty("sun.arch.data.model"); 
   if (bits != null) { 
      return bits.equals("64"); 
   } else
      // 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").contains("64"); 
   }  
 }