أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
We can invoke the external process in Java using exec() method of Runtime Class .
Example Below:
import java.io.*;
public class Main
{
public static void main(String args[])
{
try {
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("c:\\\\helloworld.exe");
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line=null;
while((line=input.readLine()) != null)
{ System.out.println(line);
}
int exitVal = pr.waitFor();
System.out.println("Exited with error code "+exitVal);
} catch(Exception e)
{
System.out.println(e.toString());
e.printStackTrace();
} }}
Copied From:
http://www.javaken.com/forum/showthread.php?t=2749 .
exec