I have a java program that will be constantly running and can only be stopped by user intervention. I would like to know how do I go about stopping a java program in such a fashion that it performs a few steps first then stops after it gets some kind of signal.
You said: "... be stopped by user intervention. ", and "... after it gets some kind of signal."
You need to be clear what kind of user intervention you are trying to use as the signal. If you are talking about a key stroke, sorry, Java is not designed to implement command console interactions. You picked a wrong language. However, if you are talking about a button/link/image click/onMouseOver/whatever events on an AWT/Swing/HTML UI, surely you can do it easily: you need to have a method to handle that event, and that method does your final steps before exit(0).