简体   繁体   English

如何在Java桌面应用程序中实现系统通知

[英]How to implements, system notification in java desktop application

I want to build a simple system notification in my Java desktop application. 我想在Java桌面应用程序中构建一个简单的系统通知。 So, after some search on web, I have find JCarrierPigeon library to do this. 因此,在网上搜索后,我找到了JCarrierPigeon库来执行此操作。

So after insert the two library I have this code: 因此,在插入两个库之后,我得到了以下代码:

package prove;

import javax.swing.JFrame;

import net.sf.jcarrierpigeon.Notification;
import net.sf.jcarrierpigeon.NotificationQueue;
import net.sf.jcarrierpigeon.WindowPosition;

public class NOtification {

    public static void main(String[] args){
        NotificationQueue queue = new NotificationQueue();



            JFrame window1 = new JFrame();

            Notification note1 = new Notification(window1, WindowPosition.BOTTOMRIGHT, 25, 25, 1000);

            queue.add(note1);
    }
}

But if I try to run it, I have this error: 但是,如果我尝试运行它,则会出现此错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/jdesktop/animation/timing/TimingTarget
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at prove.NOtification.main(NOtification.java:18)
Caused by: java.lang.ClassNotFoundException: org.jdesktop.animation.timing.TimingTarget
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 13 more

How can I fixed it? 我该如何解决?

The Homepage of JCarrierPidgeon states: JCarrierPidgeon首页指出:

"First of all, be sure to include the Timing Framework library in your classpath." “首先,请确保在您的类路径中包括Timing Framework库。”

And the errormessage looks like you did not do this. 错误消息看起来像您没有执行此操作。

The Homepage also provides a link to that library. 主页还提供了该库的链接。 I won't do it here, because it is likely to become out of date. 在这里我不会做,因为它可能会过时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM