问题
Is it possible to create via Install4J a single media file for Windows that can run in both cases when user has 32bit or 64bit JRE installed?
I have a case where I'm wrapping an application that has no need for 64bit OS features. So I have selected a 32bit (Install4J) executable to be generated. Eventually we experienced problems when we have tried to install on 64bit Win7 that has 64bit JRE installed. Installer complained about a missing 32bit JRE.
In Help Guide of Install4J I have found the following:
On Windows, a native executable can be either a 32-bit or a 64-bit executable. If you need a 64-bit JRE for your application you can choose to generate 64-bit installers and launchers for a media file. Note that it is not possible to create launchers that work with both 64-bit and 32-bit JREs. Since the launcher starts the JVM with the JNI interface by loading the JVM DLL, the architecture has to be the same. If you target both 32-bit and 64-bit JREs and operating systems, you have to generate different media files for them.
I'm hoping that bold is referring for those cases when you do need specific 64bit features.
Any help? Thanks in advance.
回答1:
Unfortunately that is not possible at this time. I would recommend to use a 32-bit JRE bundle. This will work for both 32-bit Windows and 64-bit Windows. The case of an already installed 64-bit JRE may not be so important.
回答2:
I have managed to found the solution that is actually a "hack".
The idea is to pack appropriate 32bit Java as bundle and to instruct Install4J not to use user's Java and not to depend on it. As output Install4J will create "jre" folder on the same level where the app itself is installed. By doing so it is even possible to run both installer and app when user has no JRE installed on the machine.
The way I have created such Install4J configuration is following:
- open "Media" and then "Windows" (or any other if you want to bundle JRE for Unix or Mac)
- select "Bundled JRE"
- check "Bundle the following JRE" and then locate Java version you want
- leave unchecked both "Install as shared JRE" and "Install only if no other suitable JRE is found" (this will place JRE in folder where you have installed the app)
回答3:
Newer versions of install4j have a 32 / 64 bit switch in the media files. I think starting with install4j 4.
You still need to have a matching JRE in the target environment or as you wrote bundle it. Bundling is the safer way, if installer size is not an issue.
来源:https://stackoverflow.com/questions/10896026/running-install4j-on-64bit-jre-in-win