badass-jlink-plugin
badass-jlink-plugin copied to clipboard
Can't run macOS app created using jpackage 15
Plugin Version:
id("org.beryx.jlink") version "2.22.3"
Build jdk:
JAVA_VERSION="11.0.9.1" (Azul)
jpackage jdk:
JAVA_VERSION="15.0.1" (Azul)
When trying to run the macOS .app created using jpackage 15, it starts and then immediately exists. When trying to run it from the command line, the following error is displayed:
Error opening "/Users/vewert/DevProj/UTMCoordinateConverter/rel/2.0.1.0/mac/UTM Coordinate Converter.app/Contents/Contents/app/UTM Coordinate Converter.cfg" file: No such file or directory
When I look in the .app bundle Contents, I can see the .cfg file, so I'm not sure what is going on.
I did notice, however, if I compare the .cfg file created with jpackage 15 to one created with jpackage 14, they have a slightly different format, and the one created with jpackage 15 seems to be missing entries in the [Application]
section.
I have attached both .cfg files.
I also noticed that the .app bundle created by jpackage 15, also includes a .jpackage.xml, that isn't included in the bundle created by jpackage 14 (not sure if that matters).
I'm not sure if this is a problem with the plugin, with jpackage 15, or something in my set up. Note: using the exact same set up, but using jpackage 14, works fine.
Could you run with --debug or at least --info flags and post the relevant pieces? This could at least show you what arguments are being sent to the jpackage command. It's possible that this is related to this bug.
Do you run it via a symlink? If yes, then the error may be caused by this bug.
Based on the error message, it does look like it could be related to: JDK-8248905, but I don't think I am running it via a symlink. I just double-click the .app file as usual. I also looked at the executable inside the .app bundle, and it also doesn't seem to be a symlink, so I am not sure.
I tried running with --info, and if it helps I've included the jpackage command:
Starting process 'command '/Library/Java/JavaVirtualMachines/zulu-15.jdk/Contents/Home/bin/jpackage''. Working directory: /Users/vewert/DevProj/UTMCoordinateConverter Command: /Library/Java/JavaVirtualMachines/zulu-15.jdk/Contents/Home/bin/jpackage --type app-image --dest /Users/vewert/DevProj/UTMCoordinateConverter/build/jpackage --name UTM Coordinate Converter --module ca.ewert.coordinateConverter/ca.ewert.coordinateConverter.UTMCoordinateConverterApplication --app-version 2.0.1 --runtime-image /Users/vewert/DevProj/UTMCoordinateConverter/build/image --java-options -Dprism.lcdtext=false --java-options --add-exports --java-options java.desktop/com.apple.eio=ca.ewert.coordinateConverter --java-options --add-opens --java-options javafx.graphics/com.sun.javafx.tk.quantum=centerdevice.nsmenufx --java-options --add-opens --java-options javafx.graphics/com.sun.javafx.tk=centerdevice.nsmenufx --java-options --add-opens --java-options javafx.graphics/com.sun.glass.ui=centerdevice.nsmenufx --java-options --add-opens --java-options javafx.graphics/com.sun.glass.ui.mac=centerdevice.nsmenufx --java-options --add-opens --java-options javafx.graphics/com.sun.javafx.menu=centerdevice.nsmenufx --java-options --add-opens --java-options javafx.controls/com.sun.javafx.scene.control=centerdevice.nsmenufx --java-options --add-opens --java-options javafx.graphics/com.sun.javafx.tk.quantum=ca.ewert.merged.module --java-options --add-opens --java-options javafx.graphics/com.sun.javafx.tk=ca.ewert.merged.module --java-options --add-opens --java-options javafx.graphics/com.sun.glass.ui=ca.ewert.merged.module --java-options --add-opens --java-options javafx.graphics/com.sun.glass.ui.mac=ca.ewert.merged.module --java-options --add-opens --java-options javafx.graphics/com.sun.javafx.menu=ca.ewert.merged.module --java-options --add-opens --java-options javafx.controls/com.sun.javafx.scene.control=ca.ewert.merged.module --java-options -Xmx512m --java-options --add-opens --java-options java.base/java.net=com.sothawo.mapjfx --java-options --add-opens --java-options org.controlsfx.controls/org.controlsfx.control.textfield=ca.ewert.coordinateConverter --java-options -Dlog4j.configurationFile=log4j2.xml --app-version 2.0.1 --vendor Ewert Technologies --description UTM Coordinate Converter --copyright 2020 Ewert Technologies --icon /Users/vewert/DevProj/UTMCoordinateConverter/src/main/buildResources/img/logo.icns --mac-package-identifier ca.ewert.coordinateConverter --mac-package-name UTM Coordinate Converter
The jpackage command looks good. The problem is most likely with jpackage itself.
It would be interesting to see if you get the same error when building with jpackage 16-ea.
Good idea! I'll give that a try and let you know.
I tried using jpackage from 16-ea, but unfortunately I got the same error. I think, for now, I'll stick with using jpackage from jdk14.
That's probably the only option for now.
Just tried 16.0.1 and I still see this issue.
Hey @johanvos, have you seen this problem?
fx2048.app/Contents/MacOS master -> origin/master ✔ 2d0h java:16.0.1
▶ ./fx2048
Error opening "/Users/bruno/myprojects/fx2048/build/installers/fx2048.app/Contents/Contents/app/fx2048.cfg" file: No such file or directory
fx2048.app/Contents/MacOS master -> origin/master ✔ 2d0h java:16.0.1
▶ tree ../../ -L 4
../../
└── Contents
├── Info.plist
├── MacOS
│ └── fx2048
├── PkgInfo
├── Resources
│ └── fx2048.icns
├── app
│ └── fx2048.cfg
└── runtime
└── Contents
├── Home
├── Info.plist
└── MacOS
This seems fixed in 17-ea (at least build 31).
https://bugs.openjdk.java.net/browse/JDK-8260335
But I still can't produce a good PKG for MacOS. The app image works, but not the PKG after installed.
@brunoborges Try this: set the environment variable _JAVA_LAUNCHER_DEBUG
to 1
and then start the installed application from the terminal. For example:
set _JAVA_LAUNCHER_DEBUG=1
cd /Applications/helloworld.app
./Contents/MacOS/helloworld
You should see some debug messages. Maybe they help to pinpoint the problem.
@siordache thanks! Sorry I forgot to report back, but I was able to get a log using $ open [params] fx2058.app, by directing stdout/stderr to a file.
It was an issue with the Java code itself.
👍