I'm written a Java-based application for macOS created using Oracle's javapackager
from Java 8. It worked perfectly for months until something changed, possibly due to a recent Java update, and now when I rebuild the application, the result exits without any messages when executed. Running the jar file itself directly in a terminal shell (i.e., with java -jar path/to/my.jar
) works normally without errors. I am at a loss to figure out what is going wrong with the .app
version, and cannot figure out how to get any diagnostics from whatever the thing created by javapackager does.
How can I trace what a .app
created using javapackager
does when it runs?
I'm using the -deploy -native image
option to javapackager
from Oracles Java 1.8 u152 to create the application on OSX 10.12.6. My question is specifically about how to get the resulting .app
to print what it is doing, or get error diagnostics, or something, to help figure out what it is doing under the hood. I don't need help with running javapackager
itself.
I thought that using Console
would help to understand what is happening, but the information is too sparse and difficult for me to interpret. After hiding a lot of other process output, it boils down to the following being printed:
default 22:43:22.523842 -0800 taskgated MacOS error: -67062
default 22:43:22.733680 -0800 SBML Test Runner WARNING: The Gestalt selector gestaltSystemVersion is returning 10.9.6 instead of 10.12.6. This is not a bug in Gestalt -- it is a documented limitation. Use NSProcessInfo's operatingSystemVersion property to get correct system version number.
Call location:
default 22:43:22.733853 -0800 SBML Test Runner 0 CarbonCore 0x00007fff97a4d1b1 ___Gestalt_SystemVersion_block_invoke + 121
default 22:43:22.733876 -0800 SBML Test Runner 1 libdispatch.dylib 0x00007fffac28b8fc _dispatch_client_callout + 8
default 22:43:22.733897 -0800 SBML Test Runner 2 libdispatch.dylib 0x00007fffac28b8b9 dispatch_once_f + 38
default 22:43:22.733930 -0800 SBML Test Runner 3 CarbonCore 0x00007fff979db292 _Gestalt_SystemVersion + 976
default 22:43:22.733982 -0800 SBML Test Runner 4 CarbonCore 0x00007fff979daaad Gestalt + 139
default 22:43:22.734010 -0800 SBML Test Runner 5 libswt-pi-cocoa-4628.jnilib 0x00000001283072de Java_org_eclipse_swt_internal_cocoa_OS_Gestalt + 158
default 22:43:22.734028 -0800 SBML Test Runner 6 ??? 0x00000001067919f4 0x0 + 4403567092
Although the taskgated
error at first seemed relevant, some Googling around suggests it's a common issue and not fatal.
First of all I'd verify that the actual JVM starts by invoking the binary in the packaged app bundle via Terminal:
In case of JVM errors you'll get output printed to stdout. If you can confirm that the JVM starts normally, you might be able to do further analysis using jvisualvm.