Exception in thread "main" java.lang.Error: Cannot load javax.swing.plaf.metal.MetalLookAndFeel
at java.desktop/javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1406)
at java.desktop/javax.swing.UIManager.initialize(UIManager.java:1517)
at java.desktop/javax.swing.UIManager.maybeInitialize(UIManager.java:1483)
at java.desktop/javax.swing.UIManager.getDefaults(UIManager.java:709)
at java.desktop/javax.swing.UIManager.getColor(UIManager.java:751)
at java.desktop/javax.swing.plaf.nimbus.DerivedColor.rederiveColor(DerivedColor.java:81)
at java.desktop/javax.swing.plaf.nimbus.NimbusDefaults.getDerivedColor(NimbusDefaults.java:1640)
at java.desktop/javax.swing.plaf.nimbus.NimbusDefaults.addColor(NimbusDefaults.java:1597)
at java.desktop/javax.swing.plaf.nimbus.NimbusDefaults.addColor(NimbusDefaults.java:1591)
at java.desktop/javax.swing.plaf.nimbus.NimbusDefaults.initializeDefaults(NimbusDefaults.java:249)
at java.desktop/javax.swing.plaf.nimbus.NimbusLookAndFeel.getDefaults(NimbusLookAndFeel.java:138)
at snowflake.App.main(App.java:68)
/**
* Returns the {@code UIDefaults} from the current look and feel,
* that were obtained at the time the look and feel was installed.
* <p>
* In general, developers should use the {@code UIDefaults} returned from
* {@code getDefaults()}. As the current look and feel may expect
* certain values to exist, altering the {@code UIDefaults} returned
* from this method could have unexpected results.
*
* @return <code>UIDefaults</code> from the current look and feel
* @see #getDefaults
* @see #setLookAndFeel(LookAndFeel)
* @see LookAndFeel#getDefaults
*/
public static UIDefaults getLookAndFeelDefaults() {
maybeInitialize();
return getLAFState().getLookAndFeelDefaults();
}
* Antialiasing might be forced off if the desktop is GNOME and the user
* has set his locale to Chinese, Japanese or Korean. This is consistent
* with what GTK does. See com.sun.java.swing.plaf.gtk.GtkLookAndFeel
* for more information about CJK and antialiased fonts.
So it's recommend to set a default UIDefault in muon-app/src/main/java/muon/app/ui/laf/AppSkin.java
I found a typo in error bypass command
plat => plaf
java -jar -Dswing.defaultlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel snowflake-v1.0.4.jar
to bypass this error.
java -jar snowflake-1.0.4.jar
Error Message:
After some digging, I found that it is caused by http://hg.openjdk.java.net/jdk/jdk11/file/1ddf9a99e4ad/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java#l839
the
deafults
is null pointer.caused by http://hg.openjdk.java.net/jdk/jdk11/file/1ddf9a99e4ad/src/java.desktop/share/classes/javax/swing/UIManager.java#l1086
And these code will only be executed when using CJK env see http://hg.openjdk.java.net/jdk/jdk11/file/1ddf9a99e4ad/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java#l796
So it's recommend to set a default UIDefault in muon-app/src/main/java/muon/app/ui/laf/AppSkin.java
Also please fix this in older versions (v1.0.4 and 1.0.3)
Thanks.
Currently i can use
java -jar -Dswing.defaultlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel snowflake-v1.0.4.jar
to bypass this error.