• Post Reply Bookmark Topic Watch Topic
  • New Topic

need help on properly exiting java program  RSS feed

 
joseph dela cruz
Ranch Hand
Posts: 38
Chrome Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


what if i ran this on cmd and i closed it via x button does it end the program? if not why and how do i resume to my program if ever i lost reference to it?
if it exits how do i create a program that works on background and can resume to it anytime?
need your help guys.
thanks in advance
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
joseph dela cruz wrote:

what if i ran this on cmd and i closed it via x button does it end the program?


What happens when you try it out? You can usually see the list of running applications, and this application would be seen as a java.exe. So give it a run and see if closing the window causes the application to stop.


if not why and how do i resume to my program if ever i lost reference to it?
if it exits how do i create a program that works on background and can resume to it anytime?
need your help guys.
thanks in advance


My guess is you want an application to run as a service, in the background, without a command prompt or GUI showing all the time. There are a few ways to do this. I think the pure Java way is not really running as a Service, but instead, using SystemTray and TrayIcon. You let your application run with a GUI via javaw.exe instead of java.exe. You use SystemTray and TrayIcon to provide an icon and menu that can be used to interact with/show/hide the application, and you hide all other GUI components. I believe the API for SystemTray has some example code.

Other ways of doing this include running the application as a true service that starts automatically and has no GUI at all. There are a number of Java Service Wrappers to help you with this, but none of them are from Oracle, you will need 3rd party software.
 
joseph dela cruz
Ranch Hand
Posts: 38
Chrome Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks i am trying to build a server that can run in a background and manage it anytime for my chat application.
i think system tray is the proper way to do it like wampserver although my pet project is crapt compared to wampserver
thank you again very much
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good thing that somebody was able to help. I shall move this discussion as being too difficult for “beginning”.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!