请问怎么用java来启动一个外部应用程序.

03-09-21 fly6677
请问怎么用java来启动一个外部应用程序.如启动word应用。急急 thx

lunxian
2003-09-21 17:00
java.lang.Runtime.exec()方法,自己看看文档

anonymous
2003-09-24 16:17

// 在此输入java代码
try {

    String command = "/usr/bin/yourCommand";

    Process child  = Runtime.getRuntime().exec(command);

    // 取得输入流
    InputStream inS = child.getInputStream();
    BufferedReader in = new BufferedReader(new InputStreamReader(inS, "ISO8859_1"));
<p>

猜你喜欢