1

I've created a JavaFX 2 app of which I'm adding a command-line mode (so that it can be run in a batch mode from nightly scripts). For this to be effective, I want to set the exit status to indicate errors. I'm doing this with this code:

if (errorOccurred) {
    Platform.exit();
    System.exit(exitCode);
}

This works fine when I run it from the IntelliJ, and I see this in the Console window:

Process finished with exit code 255

When I run the jar from the command line it also works:

$ java <snip-lots-of-arguments> cool_app.Main
$ echo $?
255

But after I use javapackager to turn the jar into a native application, it stops working:

$ javapackager -deploy -native -outdir out -outfile "cool_app.app" -srcfiles cool_app.jar -appclass cool_app.Main -name "cool_app" -title "cool_app"
$ open out/cool_app.app
$ echo $?
0

I'm using JDK 8u40 on MacOS 10.10.4.

Is there something I'm missing? Or a bug in javapackager?

Buddy
  • 10,874
  • 5
  • 41
  • 58

0 Answers0