10

Possible Duplicate:
installed jvm is 64 bit or 32 bit

How do I check which bit version of Java is installed on my linux machine? When I type:

java -version

I get:

java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Server VM (build 14.2-b01, mixed mode)

Is that 32bit or 64bit?

Community
  • 1
  • 1
u123
  • 15,603
  • 58
  • 186
  • 303

4 Answers4

22

Run java with -d64 or -d32 specified, it will give you an error message if it doesn't support 64-bit or 32-bit respectively. Your JVM may support both.

sjr
  • 9,769
  • 1
  • 25
  • 36
1

Why don't you examine System.getProperty("os.arch") value in your code?

Lukasz
  • 7,572
  • 4
  • 41
  • 50
0

Go to this JVM online test and run it.

Then check the architecture displayed: x86_64 means you have the 64bit version installed, otherwise it's 32bit.

tomeduarte
  • 2,803
  • 1
  • 17
  • 10
0

Works for every binary, not only java:

file - < $(which java) # heavyly bashic

cat `which java` | file - # universal
shellholic
  • 5,974
  • 1
  • 20
  • 30
  • This doesn't tell you if the JVM in question actually supports loading 64bit bytecodes. – sjr Jan 09 '11 at 04:22
  • 1
    There is no 32 or 64bits bytecode, it is the same. `float` and `int` are 32bits, `double` and `long` are 64bits on both architecture. – shellholic Jan 09 '11 at 11:19