I want to gracefully exit my Java program that runs as a background service on windows shutdown. No Dialogs at shutdown announcing that This program must be exit... No computer hangups...
Can JACOB or JAWIN help me in this regard?
Thanx in Advance,
Post by:Vlado Zajac
I had similar problem with a Java proxy server. I solved it by creting an empty invisible AWT window, calling pack() on it and adding WindowListener to it. It will receive windowClosing event on windows shutdown.
I seems that on Windows, a window is requires even for some nonGUI tasks. Maybe that's why the OS is called Windows.
Post by:Maki Jav
Following ur idea I have come up with this class
I am writing messages to a file in that method of TestRunMethod class.
This class is working for windows 98 ie when I logoff, restart or shutdown
This class will be helpful to others too.
Batch file running this has code
C:\jdk1.3\bin\javaw.exe TestAwtWindow EXIT
So when windows is exiting no command prompt is present to halt it on the way.
Should your application really care if the system is being shut down, or just your application is being shutdown? [ October 14, 2005: Message edited by: Michael Lloyd Lee ]
Post by:Maki Jav
The problem with shutdown hook is that I could get it respond to user using CTRL + C keys on a command prompt window running my java app. It did not do anything if user closes it by clicking on X (close). What if my non gui java app is running invisibly?
My application has to do some things on system shutdown...
ShutdownHook does not respond to system shutdowns...
This thread has been viewed 3198 times.
All times above are in ranch (not your local) time.
The current ranch time is Dec 14, 2018 17:11:03.