Could you start it from a batch file (that loops) and have it use System.exit(1)?
If so you could test the error level in the batch file and if it's 1, loop back and restart the program but if it's zero, exit the batch file.
Edit:
Do you wish to trigger the "Reset" externally (From unix?)
If so, my suggestion would be as follows:
- Create a command-line option called -restart
- When run without the command line, open a socket on a preset high port (32123?) and listen for a connection as part of starting your app.
- When you get a connection with some key string passed into it, do a System.exit(1);
- When run with -restart, instead of your normal startup connect to that port and send the correct key string and exit.
- If your restart routine can't connect, be sure to print an error message saying that the deamon isn't running.
There are other ways to send a message to the existing process, but a socket is probably the easiest--it's just a few lines of code. Another is polling for the existence of a file in some absolute location, and there is also finding the PID and killing it.
The socket as the added advantage of being platform independent.