Open gmseed opened 4 months ago
Hello. I am using SystemTray on the ubantu2204 Java 8 application. An error occurred while running this code. SystemTray systemTray = SystemTray.get();
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: dorkbox/util/OSUtil$DesktopEnv at dorkbox.jna.linux.GtkTheme.getIndicatorSize(GtkTheme.java:232) at dorkbox.systemTray.util.SizeAndScalingLinux.getTrayImageSize(SizeAndScalingLinux.java:55) at dorkbox.systemTray.util.SizeAndScaling.getTrayImageSize(SizeAndScaling.java:50) at dorkbox.systemTray.SystemTray.get(SystemTray.java:707) at dorkbox.systemTray.SystemTray.get(SystemTray.java:171)
I guess the reason is the lack of jar package. But I can't find this jar package. Can you provide me with some help? Thank you
You can find the package on maven central
Hi
I've been using SystemTray on a Java 8 app for sometime, and recently moved over to Java 21 and seeing an exception that I thought you might be interested in.
Interestingly, when I run the app in a terminal I don't see the exception and things work fine. It is only when I run it in IntelliJ that I see the exception.
[main] ERROR dorkbox.systemTray.SystemTray - Unable to create tray type: '_GtkStatusIconNativeTray' java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) at dorkbox.systemtray/dorkbox.systemTray.SystemTray.get(SystemTray.java:799) at dorkbox.systemtray/dorkbox.systemTray.SystemTray.get(SystemTray.java:171) at ... Caused by: java.lang.IllegalAccessError: superclass access check failed: class dorkbox.util.ImageUtil$1 (in module dorkbox.utilities) cannot access class java.awt.Component (in module java.desktop) because module dorkbox.utilities does not read module java.desktop at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1105) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:182) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:821) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(BuiltinClassLoader.java:741) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:665) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) at dorkbox.systemtray/dorkbox.systemTray.util.ImageResizeUtil.getTransparentImage(ImageResizeUtil.java:64) at dorkbox.systemtray/dorkbox.systemTray.util.ImageResizeUtil.getTransparentImage(ImageResizeUtil.java:56) at dorkbox.systemtray/dorkbox.systemTray.ui.gtk._GtkStatusIconNativeTray.<init>(_GtkStatusIconNativeTray.java:69) at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ... 6 more