Skip to main content

[JDIC] System Tray Exception

3 replies [Last post]
Anonymous

I am getting the following exception while trying to add a system tray
icon in Windows XP SP2.

Exception in thread "Thread-4" java.lang.NoSuchMethodError: notifyEvent
at org.jdesktop.jdic.tray.internal.impl.DisplayThread.initTray(Native Method)
at org.jdesktop.jdic.tray.internal.impl.DisplayThread.run(Unknown Source)

Here is the initialization code:

JPopupMenu menu = new JPopupMenu("Tray Icon Menu");
menu.add(new JMenuItem("Test Item"));
menu.addSeparator();
JMenuItem quitItem = new JMenuItem("Quit");
quitItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
System.exit(0);
}});
menu.add(quitItem);

// Resource file "duke.gif" must exist at the same directory
// as this class file.
ImageIcon icon = new ImageIcon("duke.gif");
TrayIcon ti = new TrayIcon(icon, "JDIC Tray Icon API Test", menu);

// Action listener for left click.
ti.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null,
"JDIC Tray Icon API Test!", "About",
JOptionPane.INFORMATION_MESSAGE);
}
});

SystemTray tray = SystemTray.getDefaultSystemTray();
tray.addTrayIcon(ti);

My library path includes:
tray.dll
WinMsiWrapper.dll
jdic.dll

thanks,

kw

--
http://www.allthingswilson.com

---------------------------------------------------------------------
To unsubscribe, e-mail: jdic-unsubscribe@jdic.dev.java.net
For additional commands, e-mail: jdic-help@jdic.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Kerry Wilson

BTW, this exception seems to be caused by the system tray call:

SystemTray tray = SystemTray.getDefaultSystemTray();

kw

On 8/6/07, Kerry Wilson wrote:
> I am getting the following exception while trying to add a system tray
> icon in Windows XP SP2.
>
> Exception in thread "Thread-4" java.lang.NoSuchMethodError: notifyEvent
> at org.jdesktop.jdic.tray.internal.impl.DisplayThread.initTray(Native Method)
> at org.jdesktop.jdic.tray.internal.impl.DisplayThread.run(Unknown Source)
>
> Here is the initialization code:
>
> JPopupMenu menu = new JPopupMenu("Tray Icon Menu");
> menu.add(new JMenuItem("Test Item"));
> menu.addSeparator();
> JMenuItem quitItem = new JMenuItem("Quit");
> quitItem.addActionListener(new ActionListener() {
> public void actionPerformed(ActionEvent evt) {
> System.exit(0);
> }});
> menu.add(quitItem);
>
> // Resource file "duke.gif" must exist at the same directory
> // as this class file.
> ImageIcon icon = new ImageIcon("duke.gif");
> TrayIcon ti = new TrayIcon(icon, "JDIC Tray Icon API Test", menu);
>
> // Action listener for left click.
> ti.addActionListener( new ActionListener() {
> public void actionPerformed(ActionEvent e) {
> JOptionPane.showMessageDialog(null,
> "JDIC Tray Icon API Test!", "About",
> JOptionPane.INFORMATION_MESSAGE);
> }
> });
>
> SystemTray tray = SystemTray.getDefaultSystemTray();
> tray.addTrayIcon(ti);
>
> My library path includes:
> tray.dll
> WinMsiWrapper.dll
> jdic.dll
>
> thanks,
>
> kw
>
> --
> http://www.allthingswilson.com
>

--
http://www.allthingswilson.com

---------------------------------------------------------------------
To unsubscribe, e-mail: jdic-unsubscribe@jdic.dev.java.net
For additional commands, e-mail: jdic-help@jdic.dev.java.net

Rob Ross

I didn't write the Windows code for the tray icon, but it does work
for me.

My guess is that at runtime, the tray.dll is really NOT in the system
library path.

Can you print out the value of that property right before you call
this method, and ensure that the library really is in your lib path?

Rob Ross, Lead Software Engineer
E! Networks

---------------------------------------------------
"Beware of he who would deny you access to information, for in his
heart he dreams himself your master." -- Commissioner Pravin Lal

On Aug 5, 2007, at 9:54 PM, Kerry Wilson wrote:

> BTW, this exception seems to be caused by the system tray call:
>
> SystemTray tray = SystemTray.getDefaultSystemTray();
>
> kw
>
> On 8/6/07, Kerry Wilson wrote:
>> I am getting the following exception while trying to add a system
>> tray
>> icon in Windows XP SP2.
>>
>> Exception in thread "Thread-4" java.lang.NoSuchMethodError:
>> notifyEvent
>> at
>> org.jdesktop.jdic.tray.internal.impl.DisplayThread.initTray(Native
>> Method)
>> at org.jdesktop.jdic.tray.internal.impl.DisplayThread.run
>> (Unknown Source)
>>
>> Here is the initialization code:
>>
>> JPopupMenu menu = new JPopupMenu("Tray Icon Menu");
>> menu.add(new JMenuItem("Test Item"));
>> menu.addSeparator();
>> JMenuItem quitItem = new JMenuItem("Quit");
>> quitItem.addActionListener(new ActionListener() {
>> public void actionPerformed(ActionEvent evt) {
>> System.exit(0);
>> }});
>> menu.add(quitItem);
>>
>> // Resource file "duke.gif" must exist at the same
>> directory
>> // as this class file.
>> ImageIcon icon = new ImageIcon("duke.gif");
>> TrayIcon ti = new TrayIcon(icon, "JDIC Tray Icon API
>> Test", menu);
>>
>> // Action listener for left click.
>> ti.addActionListener( new ActionListener() {
>> public void actionPerformed(ActionEvent e) {
>> JOptionPane.showMessageDialog(null,
>> "JDIC Tray Icon API Test!", "About",
>> JOptionPane.INFORMATION_MESSAGE);
>> }
>> });
>>
>> SystemTray tray = SystemTray.getDefaultSystemTray();
>> tray.addTrayIcon(ti);
>>
>> My library path includes:
>> tray.dll
>> WinMsiWrapper.dll
>> jdic.dll
>>
>> thanks,
>>
>> kw
>>
>> --
>> http://www.allthingswilson.com
>>
>
>
> --
> http://www.allthingswilson.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jdic-unsubscribe@jdic.dev.java.net
> For additional commands, e-mail: jdic-help@jdic.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jdic-unsubscribe@jdic.dev.java.net
For additional commands, e-mail: jdic-help@jdic.dev.java.net

irma_k
Offline
Joined: 2007-12-04

Hi All,

I'm having the same problem, getting the error
Exception in thread "Thread-4" java.lang.NoSuchMethodError: notifyEvent
at org.jdesktop.jdic.tray.internal.impl.DisplayThread.initTray(Native Method)
at org.jdesktop.jdic.tray.internal.impl.DisplayThread.run(WinSystemTrayService.java:80)

I have checked that the tray.dll and jdic.dll are loaded, and when I check the jar file, the WinSystemTrayIcon class (where the notifyEvent supposedly resides) is there alright.

Not sure what did I miss.
Any help will be greatly appreciated :)

Regards,
irma

-- edit --
Euh, I've finally fixed the problem. Clean up my JRE files and the problem was solved. Still not too sure what happened though =P
But anyway it's solved now, thanks for the attention :)

Message was edited by: irma_k