The following small Java program and jpackage
command create an app-image which when launched on Windows 10 launches multiple exe's. This does not happen before JDK 17. The same code and command using the JDK 16 jpackage results in only a single instance of Main.exe running in the Task Manager Details tab. Issue appears to still happen in JDK 18 and 19.
import javax.swing.*;
public class Main {
public static void main(String[] args) {
JDialog dialog = new JDialog();
dialog.setVisible(true);
}
}
jpackage --type app-image --input jpackage_test_jar --dest install/tmp --main-jar jpackage_test.jar --main-class Main
Result (Main.exe twice in Task Manager Details)
Tested the same code and jpackage command on JDKs 15, 16, 17, 18 and 19. Multiple exe's are launched on Windows 10 in JDKs 17, 18 and 19, but not in 15 or 16. JDK 15 was from AdoptOpenJDK, the rest were Eclipse Temurin from Eclipse Adoptium.
I see you created an issue for this: https://bugs.openjdk.org/browse/JDK-8301247
As a possible workaround, since you're building an image, and then building an installer from that, you could swap out the executable with one that's made with a previous version of jpackage before you build the installer. In fact, you can use any older one. Just rename it appropriately and it should work.