We have a desktop-based swing app running fine with Oracle JDK 1.8. After moving to OpenJDK 11 we got some not found exceptions for classes com.sun.java.swing.Painter
, we resolved that by generating a bundled jar that contains some classes of com.sun.java.swing.Painter.java
and some 4-5 classes and added it by
java --patch-module java.desktop=custombundle.jar -classpath path_of_jars starter_class*
Now everything works fine with AdoptOpenJDK11 or OpenJDK11 on Windows systems. But on Linux (Ubuntu-64 bits or any ARM-based Linux environments) we got another class not found/No class def exception related to class com.sun.java.swing.plaf.windows.WindowsLookAndFeel
from the third-party libraries we used.
We can not remove the calls to com.sun.java.swing.plaf.windows.WindowsLookAndFeel
because they are in 3rd party libs. The company providing the libs and also other forum sites suggest adding:
--add-exports java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED*
java --add-exports java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED --patch-module java.desktop=custombundle.jar -classpath path_of_jars starter_class*
but after adding this get a warning such as
WARNING: package com.sun.java.swing.plaf.windows not in java.desktop
and we got still the class not found exceptions for com.sun.java.swing.plaf.windows.WindowsLookAndFeel
I tried java.desktop/com.sun.java.swing.plaf.gtk
instead of java.desktop/com.sun.java.swing.plaf.windows
, the warning disappeared but still not working. Any suggestions?
Adopt OpenJDK version: latest (11.0.8.10)
Ubuntu: 20.04 (recent)
Note: Swing Issue on Java 10 did not help