AWT和Ubuntu 20 - ≫当前平台不支持系统托盘

发布于 2025-02-06 14:39:45 字数 2140 浏览 2 评论 0原文

我正在尝试运行此解决方案 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:

enter image description here.

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心如荒岛 2025-02-13 14:39:46

这是JDK中的错误。问题是在这里

It is a bug in JDK. Issue is here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文