
25/04/2011, 14:17
|
| | Fecha de Ingreso: febrero-2010
Mensajes: 26
Antigüedad: 15 años Puntos: 0 | |
Respuesta: Error al ejecutar comando Disculpen, este es el código que utilizo: String line;
ArrayList<String> errores=new ArrayList<String>();
int _exit_value=1;
try
{
Process proc=Runtime.getRuntime().exec(command);
//Obtener la salida estandar de errores y guardarlos en una lista
InputStream error_stream=proc.getErrorStream();
BufferedReader br = new BufferedReader (new InputStreamReader(error_stream));
while ((line=br.readLine())!=null)
{
System.out.println(line);
errores.add(line);
}
//Esperar a que termine el proceso
proc.waitFor();
System.out.println("El valor de retorno del comando "+command+" ha sido "+proc.exitValue());
_exit_value=proc.exitValue();
}
catch(IOException e)
{
e.printStackTrace();
JOptionPane.showMessageDialog(null, "Error "+e.getMessage());
}
String[] result=new String[errores.size()];
return _exit_value; |