Tuesday 27 May 2014

Java : Get Operating System Bit type in windows


class OsBitType{
 public static void main(String args[]){
  String arch1 = System.getenv("PROCESSOR_ARCHITECTURE");
  String arch2 = System.getenv("PROCESSOR_ARCHITEW6432");
  
  String realArch;
  realArch = arch1.endsWith("64") || arch2 != null && arch2.endsWith("64") ? "64" : "32";     
  System.out.println(realArch);        
 }        
}

Sample Output
64
                                                             Home

No comments:

Post a Comment