- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Re: How to get the bit version of java, which user has chosen during installation?
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
How to get the bit version of java, which user has chosen during installation?
During installation of my application using InstallAnywhere, user has to choose the path of java, which he later wants to use for running the application. Since application requires java 1.8, 32-bit version, when user selects path to java, if version or bit-version doesn't match, user has to be notified. How this can be done?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi @ineena,
I believe that you can use os.arch to get the JVM bitness, as it returns different bitness based on the JVM used (ie 32-bit/64bit). It should ideally return the OS architecture but it seems to return the JVM bitness.
You can try this by running a small program in 32-bit/64-bit JVM:
System.out.println(System.getProperty("os.arch"));
(* Not sure if this has changed in the latest versions of Java)
Thanks,
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi @UtsabKarmakar ,
Thanks for your reply. As you said, if I run the sample program with this property in eclipse, it gives the bit version of the java which is given in project. But, when I use this property in InstallAnywhere, it always points to the bit-version of java from environment variable. My requirement is to get the bit version, which the user has selected during the installation process.
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi @ineena,
Well that will be a tricky one, the easy way will be executing process java -d32/-d64 to get the output and then parse it.
Or read the bitness of the java.exe from the PE Header (0x8664 | 0x14c) see: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format. (may be not recommended)
Or running a .jar(where you get the os.arch) from the selected java.exe, but here there is a minor complication of where to store the .jar, as all the payloads will be deployed during installation.
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Not sure why no one suggested $prop.os.arch$, all the Java properties are exposed through IA variables prefixed with prop.