I have a Java 1.6 desktop application, started with javaw from a batch file on Windows XP. There is a .lnk link to this batch file, which is placed to windows Startup folder in order to start this application on every system boot. The application uses SystemTray class to display an icon on the system tray in case it is running. Starting this application manually there is no problem. If it is started by windows startup process, there is no icon displayed (not even a blank icon), however the application is running. The startup process is also slowed down. How can I overcome this? Thank you!
A:
Are you starting the Java application on system boot or on user login? If you start the application before a user is logged in, there will probably be no system tray to attach to, since the system tray is associated with the user session.
If you don't need the Java application to be running before a user is logged in, it might help to move the shortcut to the user's (or all users') autostart folder.
jarnbjo
2009-10-02 12:26:30
Hi, thanks for prompt answer! It is in the all users autostart folder, so it is started after user login.
Kristof
2009-10-02 13:02:54
Then I've done exactly the same myself without having any problems, but there seem to be some general problems with applications in the startup folder adding system tray icons:http://www.tech-pro.net/howto_013.htmlPerhaps you can try to let your application wait a short while, e.g. 30 seconds, before adding the icon?
jarnbjo
2009-10-02 13:24:49
Thanks! You are right, application should wait for some time. The funny thing is that sometimes it appears on the systray after startup, sometimes not...
Kristof
2009-10-03 09:46:03