13

The thing I'm trying to find out is if my JRE is for 32-bit or 64-bit.

And yes, I have tried java -version / -showversion / -fullversion but it doesn't say anything useful (at least not to me).

This is what I get when I do java -version:

java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode)

So all I have access to is a zipped JRE's bin-folder, a different JRE is installed and setup, that's not the one I'm trying to check the version of.

Any ideas?

marko
  • 3,736
  • 6
  • 29
  • 46
  • 4
    If it were 64 bits, it would say 64 bits, so it's 32 bits. – assylias Aug 24 '12 at 07:56
  • 3
    Tried it on both 32/64 bit jres. The 32 bit one has `Java HotSpot(TM) Client VM` and the 64 bit one has `Java HotSpot(TM) 64-Bit Server VM` – verdesmarald Aug 24 '12 at 07:58
  • You may find your answer in this thread http://stackoverflow.com/questions/2062020/how-can-i-tell-if-im-running-in-64-bit-jvm-or-32-bit-jvm – Royston Pinto Aug 24 '12 at 07:59

3 Answers3

17
System.getProperty("sun.arch.data.model");
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
6

If you're trying to do it from the command line, file is your friend:

$ cat `which java` | file -
/dev/stdin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for
GNU/Linux 2.6.32, BuildID[sha1]=440c433f29884a88f874e6d8260f156f4b352818,
stripped

(Using cat because in my case java is a symlink.)

aij
  • 5,903
  • 3
  • 37
  • 41
0

I get the following when I run the command on my 64-bit machine. The java -version always gets you the on which is set in Environment properties or whatever is chosen from Java icon in JRE. There may be others as well installed on your machine. Look up on "arch".

C:\Users\nyera>java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
Naidu Ypvs
  • 161
  • 10