Start / Stop Metabase Server from Java

Is there a class/method that can be invoked from java that can safely stop / start the metabase server, assuming the metabase.jar is in the classpath?

Something like:
Metabase M = new Metabase();
M.setPort(3400);

Int PID = M.startServer();

Obviously I can exec the jar, but was hoping for something a wee bit more elegant.

thxs

Use the OS. In Windows, I deploy as a service. Then I can just restart the service. In Linux it’s similar, but I don’t know the proper names.