Skip to main content

TrayIcon launched through windows Service

1 reply [Last post]
Joined: 2006-02-17


When my application starts as a windows service the tray icon is not available. This happens only when you restart the machine. If you go to services -> restart application then the tray icon appears.

The os is Windows 2000 Professional and i am using Tray Icon version 0.1.6 and JDK 1.4.2.

- shashi

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-02-14

I'm also doing this on Windows XP. The problem is that the java program starts before it knows which tray to use.

At the moment, you can work around this problem by doing a regular check to see if the tray has changed.

if (tray != null && tray!=SystemTray.getDefaultSystemTray()) {
tray = SystemTray.getDefaultSystemTray();

But this is pretty hacky.

A good solution would be some code that provided a listener for desktop changes, and user logging in / logging out. How about it jdic developers?