I have a program that will create a child process, and I want it inherit all the classpath from its parent. In javadoc, it says:
public Process exec(String[] cmdarray, String[] envp) throws IOException
Executes the specified command and arguments in a separate process with the specified environment.
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.
When I set envp to null, it didn't inherit anything.
Here is the code:
System.out.print("Debug system path: "+System.getProperty("java.class.path"));
startTime();
Process proc = Runtime.getRuntime().exec(cmd,null);
I can see the path information, but these path information is not inherited by the new created process.