package com.inforhomex;
import java.io.*;
public class Main {
public static void main(String args[]){
Process theProcess = null;
BufferedReader inStream = null;
System.out.println("Main.main() invocado");
try{
theProcess = Runtime.getRuntime().exec("java QIBMHello");
}
catch(IOException e)
{
System.err.println("Error en el método exec()");
e.printStackTrace();
}
// leer en la corriente de salida estándar del programa llamado.
try
{
inStream = new BufferedReader(
new InputStreamReader( theProcess.getInputStream() ));
System.out.println(inStream.readLine());
}
catch(IOException e)
{
System.err.println("Error en inStream.readLine()");
e.printStackTrace();
}
}
}
Ejemlpo de Runtime.exec
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.