views:

112

answers:

1

Hello, I'm looking to launch a separate Java process from within an instance of a Spring controlled bean that runs in a Jetty container. The Jetty instance was launched from mvn jetty:run

This separate process communicates with the launching process via RMI and I'd like to be able to maintain a hook to the process's ID or Process object so that I can kill it later if I need to.

The way we are currently launching this process is to maintain a second list of jar dependencies as a Spring controller property of the launching bean. This is not a long term solution as it forces us to change versions of Jars twice (once in the pom.xml, once in the applicationContext.xml). This list is then used to buildup a class path and calls Runtime.exec to create the process.

+1  A: 

Use ProcessBuilder.

Aaron Digulla