I plan to spawn a child to do some work. I want to spawn the child using the same command line as the parent process.
For example, if the parent was started like so:
#>/usr/bin/java ParentProgram
then I would call
Runtime.exec("/usr/bin/java ChildProgram");
Example 2:
#>/usr/bin/jdb -cp ./:/home/name/tool/library.jar -Xmx4G ParentProgram
then I would call
Runtime.exec("/usr/bin/jdb -cp ./:/home/name/tool/library.jar -Xmx4G ChildProgram");
I know that I can find the classpath from the System properties. And instead of using Runtime.exec I plan to use ProcessBuilder, which copies the environment of the parent to the child's environment. But basically I want to use the same java program and arguments as the parent gets. I haven't found this information in the System properties.
So I think jdb actually starts the normal jvm with the extra args (which makes sense too). But it would still be nice to know the entire command. – TejasInstrument Nov 23 '10 at 22:36