This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
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.
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.