1

If we use Runtime.exec to create a new subprocess:

Process exec(String command) Executes the specified string command in a separate process.

How to get the value of the created process?

Bionix1441
  • 2,135
  • 1
  • 30
  • 65
  • in the link : http://stackoverflow.com/questions/4750470/how-to-get-pid-of-process-ive-just-started-within-java-program, you can get : Java 9 class Process has new method long getPid() – guillaume girod-vitouchkina Mar 21 '17 at 14:08

1 Answers1

1

Until Java 8 (included), you have to use workarounds.

From Java 9 onwards, there is a new pid() method in the Process class.

Jmini
  • 9,189
  • 2
  • 55
  • 77
assylias
  • 321,522
  • 82
  • 660
  • 783