a program that fails only when run as a macOS bundled app
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 .
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?
public class Test
// This frame is always displayed:
JFrame fr1 = new JFrame("Test 1");
fr1.setBounds(0, 0, 200, 200);
// This frame fails to display when run as a Java 10 bundled app:
JFrame fr2 = new JFrame("Test 2");
fr2.setBounds(300, 0, 200, 200);
public static void main(String args)
public void run()