Using java.lang.Runtime.exec()
Use the java.lang.Runtime.exec() method
to call programs or commands from within your Java™ program.
Using java.lang.Runtime.exec() method creates one
or more additional thread-enabled jobs. The additional jobs process
the command string that you pass on the method.
The
java.lang.Runtime.exec() method
runs programs in a separate job, which is different than the C system() function.
The C system() function runs programs in the same
job. The actual processing that occurs depends on the kind of command
that you pass in on java.lang.Runtime.exec(). The
following table indicates how java.lang.Runtime.exec() processes
different kinds of commands.
| Type of command | How command is processed |
|---|---|
| java command | Starts a second job that runs the JVM. The JVM starts a third job that runs the Java application. |
| program | Starts a second job that runs an executable program (IBM® i ILE program or PASE for i program). |
| CL command | Starts a second job that runs an IBM i ILE program. The IBM i ILE program runs the CL command in the second job. |