Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle missing Swing PLAF classes in Java 11?

For some reason we use com.sun.java.swing.plaf.windows.WindowsComboBoxUI class which worked on Windows/Linux/Mac OS platforms with Java 5.0 through Java 8.0

Starting with Java 10 and Java 11 (we will stick to it as LTS) this class not visible to classloader:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsComboBoxUI
at xxx.YYY.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.java.swing.plaf.windows.WindowsComboBoxUI
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 1 more

How can we get it working?

like image 395
Barat Sahdzijeu Avatar asked Nov 22 '18 19:11

Barat Sahdzijeu


1 Answers

We were able to replace com.sun.java.swing.plaf.windows.WindowsComboBoxUI in the code with javax.swing.plaf.basic.BasicComboBoxUI and it seems working fine.

like image 191
Barat Sahdzijeu Avatar answered Nov 08 '22 01:11

Barat Sahdzijeu