Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine JRE architecture 32-bit vs 64-bit [duplicate]

Tags:

java

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?

like image 369
marko Avatar asked Aug 24 '12 07:08

marko


People also ask

What is the difference between 32 bit Java and 64 bit Java?

In a 64-bit JVM, you can specify more memory for heap size than in a 32-bit JVM; for example, in a 32-bit JVM, the theoretical maximum memory limit is 4GB, whereas 64-bit is much higher.

How can I tell if Java is 32 bit?

We can find JVM bit size 32 bit or 64 bit by running java command from the command prompt. Or we can get it from Java program. We can use System. getProperty("sun.


2 Answers

System.getProperty("sun.arch.data.model");
like image 166
Andrew Thompson Avatar answered Sep 28 '22 09:09

Andrew Thompson


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.)

like image 24
aij Avatar answered Sep 28 '22 10:09

aij