This week's book giveaway is in the Testing forum.
We're giving away four copies of Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples and have Jeremy Kubica on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

need help on properly exiting java program

 
Ranch Hand
Posts: 38
Oracle Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Oracle Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 76844
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good thing that somebody was able to help. I shall move this discussion as being too difficult for “beginning”.
 
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic