I’ve run into a strange situation, a tiny Java Swing program that works when run from the command line (java -jar) but fails when run as a macOS bundled app created by the packager. I am using Java 10:
java version "10" 2018-03-20 Java(TM) SE Runtime Environment 18.3 (build 10+46) Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode) The specific error appears to involve creating a window with an unsupported set of style bits. A similar error is described in JDK-8181476 [1]. NSWindow logs an assertion error. The problem does not arise in Java 8, probably because it uses a different set of style bits. Does anyone have an idea why the behavior would be different for the bundled app vs the command line? Anyone willing to take a look at it? Alan [1] https://bugs.openjdk.java.net/browse/JDK-8181476 <https://bugs.openjdk.java.net/browse/JDK-8181476> package test; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class Test { public Test() { // This frame is always displayed: JFrame fr1 = new JFrame("Test 1"); fr1.getRootPane().putClientProperty("Window.style", "small"); fr1.setResizable(false); fr1.setBounds(0, 0, 200, 200); fr1.setVisible(true); // This frame fails to display when run as a Java 10 bundled app: JFrame fr2 = new JFrame("Test 2"); fr2.getRootPane().putClientProperty("Window.style", "small"); fr2.setBounds(300, 0, 200, 200); fr2.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new Test(); } }); } }