简体   繁体   中英

How to implements, system notification in java desktop application

I want to build a simple system notification in my Java desktop application. So, after some search on web, I have find JCarrierPigeon library to do this.

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:

"First of all, be sure to include the Timing Framework library in your classpath."

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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