File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Detect which kind of JRE is installed - 32 or 64 bit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Detect which kind of JRE is installed - 32 or 64 bit" Watch "Detect which kind of JRE is installed - 32 or 64 bit" New topic
Author

Detect which kind of JRE is installed - 32 or 64 bit

Pranjal Nagar
Greenhorn

Joined: Mar 23, 2010
Posts: 6
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.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

You can check the value for System.getProperty("sun.arch.data.model") which will return either of 32, 64 or unknown


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Pranjal Nagar
Greenhorn

Joined: Mar 23, 2010
Posts: 6
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.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

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
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13880
    
  10

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.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Detect which kind of JRE is installed - 32 or 64 bit
 
Similar Threads
32 bit JVM memory heap issue on 64 bit XP
i am getting error when i try to run eclips
large file support
java.lang.UnsatisfiedLinkError: \bin\ocijdbc11.dll: %1 is not a valid Win32 application
Eclipse start but return exit code=1