Assume I have a java program packaged in a executable jar which I normally start from the command line using java -jar myappjar.jar. Now I want to develop remote management application to launch this java program and also once launched I want to be able to stop it by which I mean it must call a method shutdown in my program which will do clean up work and exit the program.
Also when I launch the remote management application itself, it should tell me if the program I want to launch is already running, if so then stop it first.
Is all of above possible and how to achieve that ? Especially the most important is to be able to launch the program that is not running already.
The program that I launch is a server that keeps running forever until shutdown either manually or via remote management application. This server should in no way depend on JMX Agent or remote management application i.e. remote management application/JMX agent can be shutdown and server program still keeps running or server can be manually launched and later remote management application can be started to instrument this server program if so desired.

