wood burning stoves 2.0*
The moose likes Java in General and the fly likes how i can track an abnormal termination of a java program. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how i can track an abnormal termination of a java program." Watch "how i can track an abnormal termination of a java program." New topic
Author

how i can track an abnormal termination of a java program.

Devesh H Rao
Ranch Hand

Joined: Feb 09, 2002
Posts: 687

please let me know how can i track an abnormal termination of a java program.
i.e. on press of ^C i should be able to catch the termination and display a message.
thanks for any help.
Karel Young
Greenhorn

Joined: Mar 02, 2004
Posts: 10
Does the System throw an Exception when you do that or not?
I think that there is also an onTermination routine that you may be able to call as well


"We have a choice: the Internet or a life"
Devesh H Rao
Ranch Hand

Joined: Feb 09, 2002
Posts: 687

Originally posted by Karel Young:
Does the System throw an Exception when you do that or not?
I think that there is also an onTermination routine that you may be able to call as well

The system dosent throw an exception on exit.

i am trying out
1. Runtime.addShutdownHook
2. System.runFinalizersOnExit ()
but it is not helping much.
Devesh H Rao
Ranch Hand

Joined: Feb 09, 2002
Posts: 687

Originally posted by Devesh H Rao:

2. System.runFinalizersOnExit ()
but it is not helping much.

This worked ...
Stupid me i wasn't overriding run() in the thread i was trying to hook to runtime....
Now it works i got "In Run" on ^c
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: how i can track an abnormal termination of a java program.
 
Similar Threads
Problem with ReleaseStringUTFChars (Crash )
Running javac in windows XP home
Abnormal Termination
Finalize???
forte abnormal program termination