fvarrui / JavaPackager

:package: Gradle/Maven plugin to package Java applications as native Windows, MacOS, or Linux executables and create installers for them.
GNU General Public License v3.0
1.07k stars 133 forks source link

winrun4j don't support 32bit EXE #395

Closed gfek2001zz closed 4 months ago

gfek2001zz commented 9 months ago

help

fvarrui commented 9 months ago

Hi @gfek2001zz! Please, could you explain your issue a bit more? AFAIK winrun4j binary file is compiled for 32 bit architecture, but have to check it to be 100% sure

fvarrui commented 9 months ago

Hi @gfek2001zz! Please, could you explain your issue a bit more? AFAIK winrun4j binary file is compiled for 32 bit architecture, but have to check it to be 100% sure

Sorry, you are right. JP just distributes WinRun4J64.exe (64-bit version). I'm going to add support for 32-bit.

fvarrui commented 9 months ago

Hi again!

Changes pushed into issue-395 branch. I also used this branch to do some more improvements, as remove winrun4j-launcher auxiliary library (not needed anymore).

Tests

64-bit

JP keeps the current behaviour:

<configuration>
    <platform>windows</platform>
    <winConfig>
        <exeCreationTool>winrun4j</exeCreationTool>
    </winConfig>
</configuration>

Simplified configuration just to illustrate JP behavior

After building, you can check (using Sysinternals SisCheck tool, e.g.) that the EXE is 64-bit:

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:      23:47 13/04/2013
        Publisher:      n/a
        Company:        ACME
        Description:    HelloWorldMaven
        Product:        HelloWorldMaven
        Prod version:   1.0.0.0
        File version:   1.0.0.0
        MachineType:    64-bit

And the bundled java (generated with jlink):

C:\Users\fvarrui\GitHub\HelloWorldMaven>sigcheck target\HelloWorldMaven\jre\bin\server\jvm.dll

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\jre\bin\server\jvm.dll:
        Verified:       Signed
        Signing date:   4:30 17/01/2024
        Publisher:      Eclipse.org Foundation, Inc.
        Company:        Eclipse Adoptium
        Description:    OpenJDK 64-Bit server VM
        Product:        OpenJDK Platform 21.0.2
        Prod version:   21.0.2.0
        File version:   21.0.2.0
        MachineType:    64-bit

32-bit

I have to bundle a 32-bit JRE (see jrePath) since I'm building on a 64-bit Windows, because WinRun4J 32-bit needs it, unless your system has a 32-bit JRE installed (not my case). Notice that now when using WinRun4J you can set arch=x86 if you want a 32-bit WinRun4J.exe (on a 64-bit Windows system arch=x64 by default).

<configuration>
    <platform>windows</platform>
    <jrePath>C:\Users\fvarrui\jdks\windows\jdk-11.0.22+7-jre</jrePath>
    <arch>x86</arch>
    <winConfig>
        <exeCreationTool>winrun4j</exeCreationTool>
    </winConfig>
</configuration>

Simplified configuration just to illustrate JP behavior

And now, after building:

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:      23:47 13/04/2013
        Publisher:      n/a
        Company:        ACME
        Description:    HelloWorldMaven
        Product:        HelloWorldMaven
        Prod version:   1.0.0.0
        File version:   1.0.0.0
        MachineType:    32-bit

And the bundled java (copied from jrePath):


C:\Users\fvarrui\GitHub\HelloWorldMaven>sigcheck target\HelloWorldMaven\jre\bin\server\jvm.dll

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\jre\bin\server\jvm.dll:
        Verified:       Signed
        Signing date:   0:21 17/01/2024
        Publisher:      Eclipse.org Foundation, Inc.
        Company:        Eclipse Adoptium
        Description:    OpenJDK server VM
        Product:        OpenJDK 11.0.22
        Prod version:   11.0.22.0
        File version:   11.0.22.0
        MachineType:    32-bit

Release

Just released a snapshot version which supports WinRun4j 32-bit EXE: 1.7.6-20240227.185320-2. Take a look at how to use JP snapshot versions in the README.

Please, try it and give me some feedback. Thanks!

fvarrui commented 8 months ago

New snapshot version released with several improvements: 1.7.6-20240228.024956-3.

Now also checks if the bundled JRE matches the target architecture, preventing an invalid app from being generated.

gfek2001zz commented 8 months ago

thanks !!!

fvarrui commented 7 months ago

Branch issue-395 merged into devel, ready to be released to Maven Central asap.

fvarrui commented 4 months ago

v1.7.6 released to Maven Central