Skip to main content

Problems with Tray.

No replies
Reager
Offline
Joined: 2006-02-17
Points: 0

I get this errors:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no tray in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:992)
at org.jdesktop.jdic.tray.internal.impl.DisplayThread.(Unknown Source)
at org.jdesktop.jdic.tray.internal.impl.WinSystemTrayService.(Unknown Source)
at org.jdesktop.jdic.tray.internal.impl.ServiceManagerStub.getService(Unknown Source)
at org.jdesktop.jdic.tray.internal.ServiceManager.getService(Unknown Source)
at org.jdesktop.jdic.tray.SystemTray.(Unknown Source)
at RemindMe.RemindMeRun.main(RemindMeRun.java:43)
Exception in thread "Thread-2" java.lang.UnsatisfiedLinkError: removeIcon
at org.jdesktop.jdic.tray.internal.impl.WinTrayIconService.removeIcon(Native Method)
at org.jdesktop.jdic.tray.internal.impl.WinTrayIconService.removeAllIcons(Unknown Source)
at org.jdesktop.jdic.tray.internal.impl.WinTrayIconService$1.run(Unknown Source)
Java Result: 1

when i'm running this code:

Icon icon = new ImageIcon("E:\\Programmering\\Java\\Java 5 Doc\\docs\\images\\cross.gif");

JPopupMenu menu = new JPopupMenu();
menu.add(new JMenuItem("Test 1"));

menu.addSeparator();

JMenu subMenu = new JMenu("Test 2");
subMenu.add(new JMenuItem("Test 3"));

menu.add(subMenu);

menu.addSeparator();

JMenuItem exit = new JMenuItem("Exit");

exit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});

menu.add(exit);

TrayIcon tray = new TrayIcon(icon, "My Caption", menu);

SystemTray.getDefaultSystemTray().addTrayIcon(tray);

What are I doing wrong?