Open valimaties opened 1 year ago
Seems to make a JavaFX Maven application to run on both x86 and x64 OSes there are a lot of things that should be changed in the settings and build. So, is not only a Javapackager "feature/issue" but also a build configuration for each platform.
Hi @valimaties! I'll do some research about this topic
Thanks @fvarrui I'll wait for your feedback 🤗
At present, java officially only provides 64-bit JDK
At present, java officially only provides 64-bit JDK
I'm using Liberica SDK 20, which provides both 32 bit and 64 bit sdk. Liberica is based on OpenJDK.
@valimaties
Then you can only use 32-bit JDK, 64-bit system is compatible with 32-bit applications. Or specify the 32-bit jdk or 64-bit jdk path used when packaging.
<jdkPath>${java.home}/java_jdk_x86</jdkPath>
<jdkPath>${java.home}/java_jdk_x86_64</jdkPath>
@valimaties
Then you can only use 32-bit JDK, 64-bit system is compatible with 32-bit applications. Or specify the 32-bit jdk or 64-bit jdk path used when packaging.
<jdkPath>${java.home}/java_jdk_x86</jdkPath> <jdkPath>${java.home}/java_jdk_x86_64</jdkPath>
🙂definitelly, I don't want to build the apps using only the 32bit jdk on both 32 and 64 bit OSes. So, yes, specifying the jdk when packaging is the goal, but I don't want to do it somehow manually. I tried using profiles (as I said already) but somehow the 32 bit exe file does not starts. Only 64 bit starts. Using profiles I packaged them in different location, one for 32bit and one for 64 bit. That for the 64 bit starts, but the one for the 32bit doesn't. That's why I created this issue, and Fancisco already added the "Working on" state for this issue. Maybe he find a way to build the exe file using the jdk from 32bit path. I thiink that's the issue right now.
Not only is a 32 bit JRE required, but the EXE file and the installer are also required to be 32 bit. I guess that's where the problem lies
any news?
any news?
I'm sorry, I haven't been able to make much progress, I'll try to do something over the weekend 😞
Just installed Win7 32bits in a VM (https://app.vagrantup.com/mrh1997/boxes/vanilla-win7-32bit) ... ready to do some tests
After doing some research about this issue, I found out that Launch4J generated EXE and Inno Setup installer EXE files are both 32bits, so both run on 32-bit and 64-bit Windows systems without problems:
C:\Users\fvarrui\GitHub\HelloWorldMaven>sigcheck target\HelloWorldMaven\HelloWorldMaven.exe
Sigcheck v2.90 - File version and signature viewer
Copyright (C) 2004-2022 Mark Russinovich
Sysinternals - www.sysinternals.com
C:\Users\fvarrui\GitHub\HelloWorldMaven\target\helloworldmaven\HelloWorldMaven.exe:
Verified: Unsigned
Link date: 15:01 20/07/2023
Publisher: n/a
Company: ACME
Description: HelloWorldMaven
Product: HelloWorldMaven
Prod version: 1.0.0
File version: 1.0.0
MachineType: 32-bit
C:\Users\fvarrui\GitHub\HelloWorldMaven>sigcheck target\HelloWorldMaven_1.0.0.exe
Sigcheck v2.90 - File version and signature viewer
Copyright (C) 2004-2022 Mark Russinovich
Sysinternals - www.sysinternals.com
C:\Users\fvarrui\GitHub\HelloWorldMaven\target\HelloWorldMaven_1.0.0.exe:
Verified: Unsigned
Link date: 15:54 15/02/2023
Publisher: n/a
Company: ACME
Description: HelloWorldMaven Setup
Product: HelloWorldMaven
Prod version: 1.0.0
File version:
MachineType: 32-bit
HelloWorldMaven
is just a project for testing JP.**
sigcheck
is a Sysinternals tool
@valimaties I understand therefore that it's only necessary to consider using a 32-bit JDK when bundling a JRE
Reading this article it seems that a 32-bit JVM on a 64 bit system works better than a 64-bit JVM on a 64-bit OS. It is strange, as long as many other programming languages seems to work better builded for x64 OS-es, I really don't know what to choose in the future. I will make some tests with my app using the 32 bit SDK, instead of the 64 bit one and I will came back with a feedback. One of my app uses 7zip library to make archives in a multi-task operation (multiple archives at the same time). I thought that I need more RAM to do that, so I've thought that 64bit app helps me more than a 32bit. But till I will make tests I cannot say anything.
Thanks.
Ok. I've changed the JrePath to x86 Liberica version and I've also changed it in the Project Settings page of my IntelliJ. I build the project, run maven package and it created my exe and setup.
Running setup file will install my 32bit app on the Program Files
folder of the 64bit OS, even if it must be placed in Program Files (x86)
. How do I change that?
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\\${info.iconFile.name}"
This code is from iss.vtl file, so probably {autoprograms}
will set the Program Files
, instead of Program Files (x86)
, doesn't it?
Program Files (x86)
else in Program Files
?Ok, I've just coded a patch and published as 1.7.3-20230724.135921-17
snapshot version. I tested it and it seems to be working as expected.
Now you can specify the architecture using the arch
option of JP (it's not documented yet). This option just enable next line in ISS file for 64-bit and disable for 32-bit:
ArchitecturesInstallIn64BitMode=x64
It was enabled always by default.
so use arch=x64
for 64-bit:
and arch=x86
for 32-bit:
Notice that I set
winConfig.disableDirPage=false
to show this page during installation, so I can see what is the destination directory used by Setup.
Please, test it and give me some feedback.
Thanks!
Please, keep in mind that snapshot versions are removed from the server after some weeks
I downloaded the jar file, but I was in vacation and I could not access my projects. ASAP I will make tests. Thank you very much Francisco! 🤗
Great! I hope you enjoyed your vacation 😃
Hi @valimaties! Any news?
Hi Francisco.
Durring my tests, for a 32 bits OS I set the arch parameter in pom file as you suggest, and the jrePath to 32 bits LibericaJDK. But the installer it still goes to Program Files
path in x64 environment instead of Program Files (x86)
. I tried to disable the ArchitecturesInstallIn64BitMode
parameter in iss file, but the same behavior will have.
However, the issue was not about how to select the correct path of 32 bit app in 64 bit environment. My issue was I could not create the 32 bit installer for 32 bit OS. My app did not start in this environment. But I've see that the convertion from jar to exe now is made correctly and will use the correct JRE. Or maybe my project was build using 64 bit version of JRE and the installer was set to use the 32 bit JRE.
It was better to have multiple JRE selection, like jre32Path
and jre64Path
, to be able to create both 64 bits and 32 bits installers with one click. But I asume this is not reachable as long as I have to change the path of LibericaJDK in project settings.
As a mention, in C# there is a possibility to create both 32bit and 64bit apps in the same time. Can this be done in Java? I use IntelliJ for IDE, but I cannot see such an option, like in Visual Studio for .Net apps...
So, if you have any clue about the correct path in 64 bit environment for 32 bit app, please advise.
Regards, Vali
I'm submitting a…
Short description of the issue/suggestion:
How do I generate different installers for x86 and x64 architectures in a Maven project?
Steps to reproduce the issue/enhancement:
What is the expected behavior?
I want to use the installer depending on the system I install my app, if it is a x86 system OS to use the x86 installer, and if it is a x64 OS system I want to use the installer for x64.
What is the current behavior?
I don't know how to do it, I tried something using different profiles, but I don't have any property to set to name the file depending on the profile I use. Or maybe is a wrong approach, I don't know.
Do you have outputs, screenshots, demos or samples which demonstrate the problem or enhancement?
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
Other information (e.g. related issues, suggestions how to fix, links for us to have context)