Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTKLookAndFeel error #55

Open
sgjava opened this issue Sep 26, 2021 · 4 comments
Open

GTKLookAndFeel error #55

sgjava opened this issue Sep 26, 2021 · 4 comments

Comments

@sgjava
Copy link

sgjava commented Sep 26, 2021

This is with your latest code. You may want to fix this before release. Try against JDK 17.

Running de.milchreis.uibooster.ThemeTest
java.lang.IllegalAccessException: class de.milchreis.uibooster.model.options.OSNativeUiBoosterOptions cannot access class com.sun.java.swing.plaf.gtk.GTKLookAndFeel (in module java.desktop) because module java.desktop does not export com.sun.java.swing.plaf.gtk to unnamed module @2a48d10f
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:489)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
	at de.milchreis.uibooster.model.options.OSNativeUiBoosterOptions.OSNativeLookAndFeel(OSNativeUiBoosterOptions.java:22)

@Milchreis
Copy link
Owner

Thank you. With OS do you use for it?

@sgjava
Copy link
Author

sgjava commented Sep 27, 2021

Ubuntu 20.04.

@Milchreis
Copy link
Owner

Ok, I took some research. Since Java 9 you have to tell the compiler explicit which modules of the JDK are accessable. The module "java.desktop" contains the Swing classes. In the command line you can add --add-exports java.desktop/com.sun.java.swing.plaf=ALL-UNNAMED to make the module accessable.

I added this command to the pom.xml and it works, but only for Java 9 and higher. It seems, I have to make a decision: support native Look-and-Feel or support old Java 8 version.

In my case the UI falls back to the dark LAF. Do you have the same behaviour?

@sgjava
Copy link
Author

sgjava commented Sep 27, 2021

So, you can use a profile in Maven too based on JDK http://www.avajava.com/tutorials/lessons/how-do-i-activate-a-profile-based-on-a-particular-version-of-java.html But honestly JDK 8 is pretty much EOL. JDK 11 has until 2023. I'm busy converting everything to JDK 17. LTS versions are the way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants