Monday, March 3, 2003 04:06 PM
Process p = Runtime.getRuntime().exec( "c:\temp\fortrandir\myfortran.exe", null, "c:\temp\fortrandir\" ) ) ;
to specify the current working directory in which I want to run my program. According to the javadoc:
Executes the specified command and arguments in a separate process with the specified environment and working directory.
If there is a security manager, its checkExec method is called with the first component of the array cmdarray as its argument. This may result in a security exception.
Given an array of strings cmdarray, representing the tokens of a command line, and an array of strings envp, representing "environment" variable settings, this method creates a new process in which to execute the specified command.
If envp is null, the subprocess inherits the environment settings of the current process.
The working directory of the new subprocess is specified by dir. If dir is null, the subprocess inherits the current working directory of the current process.
cmdarray - array containing the command to call and its arguments.
envp - array of strings, each element of which has environment variable settings in format name=value.
dir - the working directory of the subprocess, or null if the subprocess should inherit the working directory of the current process.