I have created a program for a icon in the System Tray in elipse, I have got it to work though was wondering, would I need to constantly keep the eclipse program running for the icon to stay permanently in the System Tray?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
I have created a program for a icon in the System Tray in elipse, I have got it to work though was wondering, would I need to constantly keep the eclipse program running for the icon to stay permanently in the System Tray?
No. eclipse is a fancy editor (an IDE) used to create java programs. Once the program has been created there is no need for eclipse. The program can be executed using the java command.would I need to constantly keep the eclipse program running
If you don't understand my answer, don't ignore it, ask a question.
keepStriving (December 9th, 2013)
When I stop the eclipse program, the icon disappears from the system tray. Should I run it with command line instead?
--- Update ---
When I stop the eclipse program, the icon disappears from the system tray. Should I run it with command line instead?
I am using Windows.
There are many ways to execute a java program. All require that the java command get the name of the class to be executed.
One way is to create a jar file with the classes and double click it.
Another is to create a batch file and double click it.
If you don't understand my answer, don't ignore it, ask a question.
keepStriving (December 9th, 2013)
I have converted my project into a JAR file which is on my desktop, how would I run a specific class from the JAR file?
--- Update ---
Double clicking the JAR file does not do anything.
The jar file needs to contain a manifest file that tells the java command what class it is supposed to execute.
If you don't understand my answer, don't ignore it, ask a question.
Thank you, I have done that, the icon is there and the program Is running, I was wondering would this mean that the program is constantly running which would affect CPU and how would I go about stopping the program for the system tray.
You launched the program by double-clicking on the executable jar, yes it is loaded and running. That does not necessarily mean it is actually doing anything, that would depend on the specific program. You could stop the program by right clicking on the icon and closing it or with the task manager or restarting the computer etc but the best way would be to include some interface that can be used to tell the program to close itself, perhaps a window (even a small one with one word "Exit").
keepStriving (December 9th, 2013)
I have an EXIT MenuItem, I suppose I need to give it proper functionality.
The system tray icon initiates a GUI which when I quit removes the system tray also, how would I get around this so when the GUI is exited the icon stays and then I will add a separate action listener for the icon so it can gracefully exit.
--- Update ---
I have figured this is because of the EXIT_ON_CLOSE operation when x is pressed, I have separate buttons which dispose of the frame instead and they leave the frame intact, is there any way I can get the default close operation of frame to dispose() instead of EXIT_ON_CLOSE or is there no way around this?
Read the API doc for the class to see what other options are available.
If you don't understand my answer, don't ignore it, ask a question.
keepStriving (December 10th, 2013)