java 1.6 SystemTray icon does not appear on window

2019-02-16 02:19发布

问题:

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!

回答1:

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.