Launch another instance of the running application

What I need is a way to execute another instance of my application, from within the application.
I would prefer that it is actually another process, because I can easily re-launch my application on another thread.

Google has not provided anything helpful.

Anyone know how I could do this?

If the problem is singletons and global objects which you don’t want to be shared between instances, you can use a selfmade (subclassed) classloader, so the second instance will run in it’s own class-space.

What about Runtime.getRuntime().exec(…)?

I guess if I combined that with finding the location of the jar file that would work.
In fact, with that in mind it’s just like writing a launcher.

Thanks for the help.

I’ll leave this open though, in case someone finds there is actually a Java function just for this. :slight_smile: