Forums Register Login
Detect which kind of JRE is installed - 32 or 64 bit
I have an application where I ask the user to enter the path to a JRE. I need to detect if the JRE enetered by the user is a 32 or 64 bit JRE. Is there a way I can detect whether the JRE is a 32 or 64 bit one.
You can check the value for System.getProperty("sun.arch.data.model") which will return either of 32, 64 or unknown
Can you help me with some code snippet?

How can I call this for a particular JRE? There could be a possibility that I have two JREs of different versions on my system.
I already gave you read made code

Do you know what System.property does? If not check the API docs.

Even if you have multiple jre versions, this call will give you the details for the jre currently being used to run your application.
Also, I am not sure if one can install a 32 bit jre/jdk on a 64 bit system and vice versa

Maneesh Godbole wrote:Also, I am not sure if one can install a 32 bit jre/jdk on a 64 bit system and vice versa

Yes you can, in fact I'm using a 32-bit JRE on 64-bit Windows right now. On Linux it's also possible to run 32-bit Java on a 64-bit Linux installation. (The reverse is not possible - you can't run 64-bit software on a 32-bit operating system).

But I'm not sure why your Java application needs to know if it's running on a 32-bit or 64-bit JRE - it should not matter what architecture the underlying operating system (or JRE itself) has for normal Java programs.

This thread has been viewed 5804 times.

All times above are in ranch (not your local) time.
The current ranch time is
Oct 18, 2018 23:50:21.