AWT和Ubuntu 20 - ≫当前平台不支持系统托盘
我正在尝试运行此解决方案 awt System tray以在我的ubuntuu上使用Javafx应用程序) 20.04.3 Lts。我尝试使用OpenJDK 14和17,结果是相同的:
Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: The system tray is not supported on the current platform.
at java.desktop/java.awt.SystemTray.getSystemTray(SystemTray.java:188)
at com.foo.fxtest1.JavaFxTest5.addAppToTray(JavaFxTest5.java:119)
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 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)
尝试解决我发现的问题这个答案:代码> GNOME 3.28(在Ubuntu 18.04中使用)删除了系统托盘。我认为,Ubuntu 20没有系统托盘,这就是问题所在。但是,在屏幕的右上角,我看到以下内容:
如您所见,有三个应用程序图标 - 电报,Viber和闹钟。据我了解,这些图标已在系统托盘中显示,所以 系统托盘存在。那是什么问题? AWT不支持Ubuntu 20系统托盘?有人可以解释吗?
I am trying to run this solution (AWT System Tray to control a JavaFX application) on my Ubuntu 20.04.3 LTS. I tried with openjdk 14 and 17, result is the same:
Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: The system tray is not supported on the current platform.
at java.desktop/java.awt.SystemTray.getSystemTray(SystemTray.java:188)
at com.foo.fxtest1.JavaFxTest5.addAppToTray(JavaFxTest5.java:119)
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 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)
Trying to solve the problem I found this answer: saying that Gnome 3.28 (used in Ubuntu 18.04) removed the System tray
. I thought, that Ubuntu 20 didn't have a system tray, and that was the problem. However, in the top right corner of my screen I see the following:
As you see there are three application icons - Telegram, Viber and Alarm clock. As I understand these icons are shown in system tray, so
system tray exists. Then what is the problem? Doesn't AWT support Ubuntu 20 system tray? Could anyone explain?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是JDK中的错误。问题是在这里。
It is a bug in JDK. Issue is here.