Setting look and feel fails under Java 17:
java.lang.IllegalAccessError: superclass access check failed: class com.jgoodies.looks.windows.WindowsLookAndFeel (in unnamed module @0x5ad8637) cannot access class com.sun.java.swing.plaf.windows.WindowsLookAndFeel (in module java.desktop) because module java.desktop does not export com.sun.java.swing.plaf.windows to unnamed module @0x5ad8637
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at net.sourceforge.squirrel_sql.plugins.laf.LAFRegister.installLookAndFeels(LAFRegister.java:389)
at net.sourceforge.squirrel_sql.plugins.laf.LAFRegister.<init>(LAFRegister.java:141)
at net.sourceforge.squirrel_sql.plugins.laf.LAFPlugin.load(LAFPlugin.java:211)
at net.sourceforge.squirrel_sql.client.plugin.PluginManager.loadPlugin(PluginManager.java:683)
at net.sourceforge.squirrel_sql.client.plugin.PluginManager.loadPlugins(PluginManager.java:448)
at net.sourceforge.squirrel_sql.client.Application.executeStartupTasks(Application.java:847)
at net.sourceforge.squirrel_sql.client.Application.startup(Application.java:239)
at net.sourceforge.squirrel_sql.client.Main.doApplicationStartup(Main.java:123)
at net.sourceforge.squirrel_sql.client.Main.lambda$startApp$0(Main.java:115)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
at net.sourceforge.squirrel_sql.client.Main$1.dispatchEvent(Main.java:103)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
I'm not sure if this solution:
https://stackoverflow.com/questions/51555030/swing-issue-on-java-10
i.e. adding command line flags such as:
--add-exports java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED
is a good way forward, especially given the efforts such as:
https://openjdk.org/jeps/403
It works as of now though.
Sorry, this issue can't be fixed as JGoodies does not offer open source updates for its Look and Feels anymore, see: http://www.jgoodies.com/downloads/libraries/
I just committed some changes to our GIT repository that handle the problem better. Excerpt from change log:
Look and Feel Plugin: Improved handling JGoodies' WindowsLookAndFeel Java 17 error.
When the error occurs SQuirreL will switch to its standard Metal/Ocean Look and Feel
and the log (see menu Window --> "View SQuirreL Logs") will contain detailed information.
Note: JGoddies Look and Feels leave tab titles empty at several places. If you are using
JGoddies please consider switching to a Metal or FlatLaf Look and Feel.
Last edit: Gerd Wagner 2022-09-04
This problem affects all L&fs that extend the Oracle Windows L&f. The latter is not part of the Java SE, and hence access to the OracleWindows L&f classes is categorized as illegal by default. This affects the JGoodies Windows L&f - both the open source and commercial version.
The fix is that you grant access to the Oracle Windows L&f classes. This could be done with a single switch in Java < 16. Since Java 16 it requires to individually grant access to modules. Depending on the Java runtime, this can be done by a start parameter, by adding export statements to a runnable JAR or by web start parameters.
Find the relevant JAR manifest entries in all JGoodies demo JARS and also in all provided .jnlp files on the same page at: https://www.jgoodies.com/downloads/demos/
The empty tab title problem of JGoodies' Look and Feels turned out to occur on Linux only. That's why for Windows the VM-Parameter
"--add-exports java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED"
was added to squirrel-sql.bat to continue supporting JGoodies' Look and Feels.
Karsten, if you have pointer to or solution for the empty tab title problem on Linux it would be kind if you'd let me known. The problem occurs for tab titles that were given a custom tab title component using JTabbedPane.setComponentAt(...).