My company has a Java application with bundled Java that we distribute to customers, both Windows and macOS users. Our setup uses Advanced Installer that creates both the msi file for Windows and the app package for macOS. We have not notarized the macOS app previously, just signed it, but now one of our customers requires notarization. Unfortuntely, the signing process that is required for notarization, breaks the app launcher file provided by Advanced Installer (this is a known problem, and they do not currently have a fix). So I have replaced it with JavaMacLauncher (https://github.com/OpenIndex/JavaMacLauncher). And now the app is correctly notarized.
But my problem is that the app no longer seem to read information from Info.plist after startup. Earlier we had to add the key NSRequiresAquaSystemAppearance with the value YES to prevent it from using dark mode, but this key is no longer respected. Additionally the LSMinimumSystemVersion key also seems to be ignored.
JavaMacLauncher is started based on the key CFBundleExecutable in Info.plist. It also fetches the Java options used when starting the app. So the file is read before startup.
So I'm wondering if I need to add some additional values to the startup script before the Java command is executed. Or if I'm missing an option in the Java command itself, maybe from where the app is launched? Do I need to refer to the bundle identifier from the startup script?
The content of my app launcher is this:
exec /Applications/MyApp.app/Contents/PlugIns/temurin-8.jdk/Contents/Home/bin/java \
-Xms32m \
-Xmx512m \
-Xdock:name="My App" \
-Xdock:icon="/Applications/MyApp.app/Contents/Resources/myappicon.icns" \
-XstartOnFirstThread \
-Dinstalled.directory="/Applications/MyApp.app/Contents/Java" \
-Dprogram.version=1.2.3 \
-Dteamdev.licence.info=true \
-d64 \
-Xdebug \
-classpath "/Applications/MyApp.app/Contents/Java/MyApp.jar;/Applications/MyApp.app/Contents/Java/lib" \
-jar "/Applications/MyApp.app/Contents/Java/MyApp.jar"
The app launcher is located in /Applications/MyApp.app/Contents/MacOS.The bundled Java is under ../Contents/PlugIns and the Java files are under ../Contents/Java.
I get the same result if I try other AppLaunchers, and also when I start the application from the terminal with the above command.
If anyone could give me some pointers, it would be greatly appreciated.
It was never the application that read Info.plist - it was the launcher. You replaced it with a different implementation, and this different implementation seems to not read the information.
But why do you need to read that information at all? It cannot be anything that was unknown at build time, so if your application needs it you can either read Info.plist in Java or inject something in your jar directy.
You might also want to consider switching to the standard packager for Java applications, JPackage.