这是一段代码,仅供参考。您可以在进程中派生本机浏览器,然后将Java
Process对象返回到您的Java代码。您可以调用该
processObject.waitFor()方法以等待被调用的进程终止。
启动器:
public class Launcher implements Runnable { public void run() { Process p; try { p = Runtime.getRuntime().exec("notepad.exe"); p.waitFor(); // Do something after the forked process terminates System.out.println("The browser is exit"); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } }}主班:
public class TestProcess { public static void main(String[] args) throws Exception { new Thread(new Launcher()).run(); }}


