0

I want to release my educational app (Java / Swing ) to the MacOS, and I'm using JDK 16.0.2 and its jpackage command line tool to build the installer/launcher.

In verbose mode, the process seems to be error-free; I get this at the conclusion:

Succeeded in building Mac DMG Package package

The installer works up to the point where I have an xxxxxxx.app (in Applications folder) and I double-click it. In the dock, the app icon appears and bounces, but control is never passed to my app's main(). There is no feedback about something wrong or unexpected.

I looked at the ActivityMonitor, and I see about 30 processes growing in response to the double-click, but they fizzle out and cease within a second or two.

SW Mfg. environment: 2021 iMac (intel) running BigSur Eclipse for Java SE (2001-3) Export "runnable jar" (jar file launches the app correctly when double clicked) JRE 16.0.2 in the build path

Has anyone encountered this type of fail-to-launch glitch where there's absolutely no indication of a problem? Is there a way to obtain verbose feedback during the execution of the app launcher? How can I debug this?

jpackage --input ~/git/DataflowGeometry/AlgoGeom_V2 --main-jar ~/DFG2D_MacOS_Manufacturing/AppJAR/DFG2D_Mac_J1602.jar --main-class ~/git/DataflowGeometry/AlgoGeom_V2/src/workspace2D/DataflowGeometry2D --dest ~/DFG2D_MacOS_Manufacturing/MacOSInstallers/DFG2D_Mac_J1602 --app-version "1.0.0"  --copyright "All rights reserved Spatial Thoughtware 2022" --name DataflowGeometry2D --description "21st Century Geometry Problem-Solving Workspace" --vendor "Spatial Thoughtware" --input ~/git/DataflowGeometry/AlgoGeom_V2/src/DFG2D_AppData --java-options "-d64 -splash:$APPDIR/SplashScreenDFG2D.png" --verbose
pbierre
  • 276
  • 1
  • 8

1 Answers1

2

The last question is the most important. How to debug the launcher?

Right-click on YourApplication.app (in the Applications Folder)...Show Package Contents.

In the MacOS folder, right-click on the Terminal icon showing your app's name. Open with Terminal....

This will show you any errors fired during the launch sequence.


My problems were 3-fold, and all except the last were revealed as errors in the Terminal text dump:

  1. I had never installed the full Java JDK 16, just the JRE 16. That's enough to compile and run the app in Eclipse, but JPackage uses code that is only in the JDK, not the JRE.

  2. In my jpackage command, I had a --java-options "-d64 -splash:xxx" , not recognized by the launcher. I deleted "-d64". If you have multiple java-options, each warrants its own --java-option statement (each should have a single option as its parameter).

I figured this last one out by guesswork:

  1. In the launch sequence, I was getting a ClassNotFoundException for my "main", which I was declaring as its absolute filepath on the sw mfg. machine. I reasoned that the launcher could find the "main" in a MANIFEST file in the runnableJar, so I merely deleted the --main-class param in my jpackage command.

Finally, I got a beautiful installer-based launch.

pbierre
  • 276
  • 1
  • 8