Search This Blog

Thursday, February 19, 2009

How to Find out whether you are using 64 bit JDK or 32 bit JDK

 

Write this sample java program

import java.util.Enumeration;
import java.util.Properties;

public class Class1 {
    public Class1() {
    }

    public static void main(String[] args) {
        Class1 class1 = new Class1();
        Properties p = System.getProperties();
        Enumeration keys = p.keys();
        while (keys.hasMoreElements()) {
          String key = (String)keys.nextElement();
          String value = (String)p.get(key);
          System.out.println(key + ": " + value);
        }

    }
}

Run the program

and check for the propert sun.arch.data.model if this shows 32 then you are running in a 32 bit JVM. If this shows 64 bit then you are in 64 bit JVM.

For the 64 bit you run the java using the following option  $ORACLE_HOME/jdk/bin/java –d64

This shows sun.arch.data.model: 64

No comments: