jQuery in Action, 2nd edition*
The moose likes General Computing and the fly likes TrayIcon for Windows Services Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "TrayIcon for Windows Services" Watch "TrayIcon for Windows Services" New topic
Author

TrayIcon for Windows Services

sharab rao
Greenhorn

Joined: Jan 09, 2013
Posts: 10
Hi,

I Created Windows service in java,
Actually my application wants to work like a service, i.e., Start automatically when windows start, work behind.. hidden.
So i created windows services, it is working what i expected.
Now, I have to show some icon of my application when that service is started.
How I get at least that icon on systemtray indicating service is running.

Thanks,
Ram
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

It's amazing the stuff you can find using Google: http://docs.oracle.com/javase/tutorial/uiswing/misc/systemtray.html


JBoss In Action
sharab rao
Greenhorn

Joined: Jan 09, 2013
Posts: 10
Thanks Peter,

I have created that System trayicon notification.
Now my concern is, It is not working as expected.
Whenever I start services(Through service wizard of windows) a trayicon should populate at Systemtray.

Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

That's not really easy. A process running as a service cannot have an icon in the tray. You need to create a GUI application which will be run "normally" (eg. from a startup menu); this application would check whether your service is running and indicate it in the user interface in any way it likes (including an icon in the system tray). However, if the user uses eg. Task Manager or similar tool to forcibly close your GUI application, or if the application crashes, the service's state won't be accurately represented in the tray after that.

How to create this GUI application is the subject of your other question, of course.
sharab rao
Greenhorn

Joined: Jan 09, 2013
Posts: 10
Martin Vajsar wrote:That's not really easy. A process running as a service cannot have an icon in the tray. You need to create a GUI application which will be run "normally" (eg. from a startup menu); this application would check whether your service is running and indicate it in the user interface in any way it likes (including an icon in the system tray). However, if the user uses eg. Task Manager or similar tool to forcibly close your GUI application, or if the application crashes, the service's state won't be accurately represented in the tray after that.

How to create this GUI application is the subject of your other question, of course.


Thanks Martin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TrayIcon for Windows Services
 
Similar Threads
Apache Monitor for starting a service but the Services window does not
start windows service from windows 7 from java
JBoss as service on 64 bit Windows server 2003
Reg. How to execute a thread based java program as a Windows Service to get a system tray icon
Start of Admin server remotely