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
  • 14,161
  • 51
  • 160
  • 272

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,619
  • 1
  • 23
  • 36
1

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

Lukasz
  • 7,336
  • 4
  • 38
  • 48
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,783
  • 1
  • 16
  • 10
0

Works for every binary, not only java:

file - < $(which java) # heavyly bashic

cat `which java` | file - # universal
shellholic
  • 5,926
  • 1
  • 19
  • 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