tmmls
tmmls

Reputation: 530

JavaFX app doesn't launch. How can I find out why?

I've created a small JavaFX app on Os X, using IntelliJ, Java 17 and JavaFX 17.0.x.

The jar file was build as an artefact. The jar file was then converted to a DMG file using jpackage. The app was signed and notarized successfully and it runs perfectly on my local Os X 10.15 machine, like a charm.

When testing the native app an another device, it doesn't open. The console event log app from OS X doesn't show any errors.

I guess it still misses dependencies. How do I find out what is going wrong?

[Update 1]

It seems after moving the original Jar file, the app no longer works on my own device as well. After using the information of James_D, I opened the app package, and it seems the Main jar file is not in the build. So it looks like the jPackage command failed, although it said it was successfully build.

I rerun the command using verbose, and I noticed this in the huge log...

[10:23:10.357] java.io.IOException: Command [/usr/bin/osascript, /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/jdk.jpackage5702973860569608302/config/myFileUploader-dmg-setup.scpt] exited with 1 code
            at jdk.jpackage/jdk.jpackage.internal.Executor.executeExpectSuccess(Executor.java:90)
            at jdk.jpackage/jdk.jpackage.internal.IOUtils.exec(IOUtils.java:205)
            at jdk.jpackage/jdk.jpackage.internal.IOUtils.exec(IOUtils.java:172)
            at jdk.jpackage/jdk.jpackage.internal.MacDmgBundler.buildDMG(MacDmgBundler.java:396)
            at jdk.jpackage/jdk.jpackage.internal.MacDmgBundler.bundle(MacDmgBundler.java:88)
            at jdk.jpackage/jdk.jpackage.internal.MacDmgBundler.execute(MacDmgBundler.java:571)
            at jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.java:676)
            at jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Arguments.java:550)
            at jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:91)
            at jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)

Could this be the raison? How do I fix this?

Upvotes: 0

Views: 747

Answers (1)

tmmls
tmmls

Reputation: 530

I was able to find the problem and solution, thanx to the feedback of @James_D.

Although jpackager displayed a message that the build was successful, the package was incomplete and did not contain the main jar file. There where errors in my jpackage command line statement.

This command line instruction works perfect:

sudo /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/jpackage --input /Users/tm/xDataStore/xSign/myFileUploader/Build --name myFileUploader --type dmg --main-jar myFileUploader.jar --main-class com.myCompany.myFileUploader.Main --icon /Users/tm/xDataStore/xSign/myFileUploader/icon.icns --mac-sign --mac-signing-key-user-name 'Developer ID Application: <removed> (<removed>)' --verbose

2 things I did wrong:

  • my input path was wrong. This must be the root folder path where the jar file is located (but not contain the jar file name)
  • the main jar file path can only be the file name of the main jar file. Do not use the full file path.

After a week of troubles, it finally works...

Ps.

I wish the entire Java app build process could be improved. Visual Studio and Xojo users just have to press a "build" button to have a rock solid executable. Java developers have a lot more work ...

Upvotes: 2

Related Questions