Problemas con el Runtime
Publicado por SARA (10 intervenciones) el 27/09/2004 20:08:53
Hola chicos, estoy teniendo muchisimos problemas para ejecutar el COCOA desde java. He creado un .bat que llame al programa y me redireccione la salida a un fichero. Si lo ejecuto desde MSDos funciona perfectamente, peor al ejecutarlo desde Java me crea el fichero, pero vacio. El codigo de terminación de la ejecucion que obtengo es 1, a lo q supongo q no esta terminando correctamente. Os inserto el codigo por si m podeis ayudar. Muchisimas gracias.
String comando = new String("c:" +File.separatorChar+ "Documents and Settings" +File.separatorChar+ "Sara " +File.separatorChar+ "Mis documentos" +File.separatorChar+ "PROYECTO" +File.separatorChar+ "todo" +File.separatorChar+ "cocoa.bat");
int terminacion;
try{
System.out.println(comando);
Runtime r = Runtime.getRuntime();
Process p = r.exec(comando);
terminacion = p.waitFor();
System.out.println("terminacion =" +p.exitValue());
}
catch (IOException exception){
exception.getCause();
}
catch (InterruptedException exception)
{
exception.getCause();
}
String comando = new String("c:" +File.separatorChar+ "Documents and Settings" +File.separatorChar+ "Sara " +File.separatorChar+ "Mis documentos" +File.separatorChar+ "PROYECTO" +File.separatorChar+ "todo" +File.separatorChar+ "cocoa.bat");
int terminacion;
try{
System.out.println(comando);
Runtime r = Runtime.getRuntime();
Process p = r.exec(comando);
terminacion = p.waitFor();
System.out.println("terminacion =" +p.exitValue());
}
catch (IOException exception){
exception.getCause();
}
catch (InterruptedException exception)
{
exception.getCause();
}
Valora esta pregunta


0