I have a fairly complex Java program that I need to be able to restart. So far, I have done that by having a small external program ("launcher") that calls the main program, so that when I want to restart, I can kill the main program thread, and have the launcher relaunch it.
The problem with the launcher is that it is a pain in the butt to install and maintain, and it's so poorly written that it's barely worth it to do either.
My question is, can I get a program to re-launch itself, and how?. I don't mean just dispose of the JFrame and recreate, I'm talking about complete restart. I don't need to restart the JVM ( I don't think) but I do want the program to start again at main().
One approach I thought of is creating a thread that will kill all the other threads in the program, then relaunch the event-dispatch thread and die itself. Is this possible? Is there a simpler way?