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

"Application cannot be opened." on macOS 15 #430

Closed rememberber closed 2 months ago

rememberber commented 2 months ago

I'm submitting a…

Short description of the issue/suggestion:

IMG_4811

Steps to reproduce the issue/enhancement:

  1. [First Step]
  2. [Second Step]
  3. [Other Steps...]

What is the expected behavior?

What is the current behavior?

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)

fvarrui commented 2 months ago

Hi @rememberber! Please, could you provide Maven output and plugin configuration?

rememberber commented 2 months ago

Hi @rememberber! Please, could you provide Maven output and plugin configuration?

io.github.fvarrui javapackager 1.7.5 true com.luoboduner.moo.tool.App true --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED bundling-for-mac package package mac true jdk.crypto.ec,jdk.charsets ${name}.l4j.ini
rememberber commented 2 months ago

Hi @rememberber! Please, could you provide Maven output and plugin configuration?

It (the .app file)works well on macOS 14,but can not open the .app file on macOS 15(the newest macOS recent released by Apple)

amariottini commented 2 months ago

Same problem with my customers: after upgrading to MacOS 15 the app doesn't start anymore.

fvarrui commented 2 months ago

Hi @rememberber and @amariottini! Are you able to run your app from BASH executing your.app/Contents/MacOS/universalJavaApplicationStub on MacOS 15? And, please, look into Console app and check if there's any error in logs

fvarrui commented 2 months ago

Sorry, I can't test on MacOS as I don't have one anymore

fvarrui commented 2 months ago

@rememberber, on your attached image, what does this message say? Could you translate it?

fvarrui commented 2 months ago

Hi @rememberber! Please, could you provide Maven output and plugin configuration?

io.github.fvarrui javapackager 1.7.5 true com.luoboduner.moo.tool.App true

                <vmArgs>--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</vmArgs>
            </configuration>
            <executions>
               <execution>
                    <id>bundling-for-mac</id>
                    <phase>package</phase>
                    <goals>
                        <goal>package</goal>
                    </goals>
                    <configuration>
                        <platform>mac</platform>
                        <createTarball>true</createTarball>
                        <additionalModules>jdk.crypto.ec,jdk.charsets</additionalModules>
                        <additionalResources>
                            <additionalResource>${name}.l4j.ini</additionalResource>
                        </additionalResources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

I can't see in your POM if you are bundling a JRE

rememberber commented 2 months ago

Hi @rememberber! Please, could you provide Maven output and plugin configuration?

io.github.fvarrui javapackager 1.7.5 true com.luoboduner.moo.tool.App true

                <vmArgs>--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</vmArgs>
            </configuration>
            <executions>
               <execution>
                    <id>bundling-for-mac</id>
                    <phase>package</phase>
                    <goals>
                        <goal>package</goal>
                    </goals>
                    <configuration>
                        <platform>mac</platform>
                        <createTarball>true</createTarball>
                        <additionalModules>jdk.crypto.ec,jdk.charsets</additionalModules>
                        <additionalResources>
                            <additionalResource>${name}.l4j.ini</additionalResource>
                        </additionalResources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

I can't see in your POM if you are bundling a JRE

<plugin>
                <groupId>io.github.fvarrui</groupId>
                <artifactId>javapackager</artifactId>
                <version>1.7.5</version>
                <configuration>
                    <bundleJre>true</bundleJre>
                    <mainClass>com.luoboduner.moo.tool.App</mainClass>
                    <generateInstaller>true</generateInstaller>
                    <vmArgs>--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</vmArgs>
                </configuration>
                <executions>
                    <execution>
                        <id>bundling-for-mac</id>
                        <phase>package</phase>
                        <goals>
                            <goal>package</goal>
                        </goals>
                        <configuration>
                            <platform>mac</platform>
                            <createTarball>true</createTarball>
                            <additionalModules>jdk.crypto.ec,jdk.charsets</additionalModules>
                            <additionalResources>
                                <additionalResource>${name}.l4j.ini</additionalResource>
                            </additionalResources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
rememberber commented 2 months ago

I tried "codesign --force --deep --sign ./universalJavaApplicationStub", got "error: The specified item could not be found in the keychain."

rememberber commented 2 months ago

@rememberber, on your attached image, what does this message say? Could you translate it?

"The Application can't open"

rememberber commented 2 months ago

Hi @rememberber and @amariottini!

Are you able to run your app from BASH executing your.app/Contents/MacOS/universalJavaApplicationStub on MacOS 15?

And, please, look into Console app and check if there's any error in logs


Last login: Thu Sep 19 23:32:08 on ttys000
zhoubo@zhoubodeMacBook-Pro ~ % /Users/zhoubo/Downloads/MooTool.app/Contents/MacOS/universalJavaApplicationStub ; exit;
zsh: killed

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
fvarrui commented 2 months ago

Please, can you try to build your app using macConfig.macStartup=ARM64 or UNIVERSAL to use a compiled version of universalJavaApplicationStub? Maybe there's a security issue related to MacOS 15 and BASH scripts

nemqooo commented 2 months ago

I have had experienced the same issue, however, using the macStartup property with UNIVERSAL value resolved the issue. @fvarrui Thank you for the idea! Appreciate your help very much!

rememberber commented 2 months ago

Successfully resolved! (using the macStartup property with UNIVERSAL) Thank you , Mr.Edge : )

fvarrui commented 2 months ago

Maybe It would be a good idea to set UNIVERSAL as the default value for macStartup property

amariottini commented 2 months ago

Solved macStartup = UNIVERSAL but now I have another error, I'll open a new issue.

fvarrui commented 2 months ago

I think we can close this issue