¿Ha explorado este comando de ejecución para un entorno de ejecución Java, cree un objeto de archivo con la ruta a la que desea "cd" y luego ingrese como un tercer parámetro para el método exec.
public Process exec(String command,
String[] envp,
File dir)
throws IOException
Ejecuta el comando de cadena especificado en un proceso separado con el entorno y el directorio de trabajo especificados.
Este es un método de conveniencia. Una invocación del formulario exec (comando, envp, dir) se comporta exactamente de la misma manera que el ejecutable de invocación (cmdarray, envp, dir), donde cmdarray es una matriz de todos los tokens bajo comando.
Más precisamente, la cadena de comandos se divide en tokens usando un StringTokenizer creado por la llamada nueva StringTokenizer (comando) sin modificaciones adicionales de las categorías de caracteres. Los tokens producidos por el tokenizer se colocan en la nueva matriz de matriz cmdarray, en el mismo orden.
Parameters:
command - a specified system command.
envp - array of strings, each element of which has environment variable settings in the format name=value, or null if the subprocess should inherit the environment of the current process.
dir - the working directory of the subprocess, or null if the subprocess should inherit the working directory of the current process.
Returns:
A new Process object for managing the subprocess
Throws:
SecurityException - If a security manager exists and its checkExec method doesn't allow creation of the subprocess
IOException - If an I/O error occurs
NullPointerException - If command is null, or one of the elements of envp is null
IllegalArgumentException - If command is empty
Un escape fue para iniciar un nuevo shell y disparar todos sus comandos su - http://www.webmasterworld.com/linux/3613813.htm – letsc