给你一段代码 ,根据自己的需要改吧 class Cmd implements Runnable { public void run () { try { Runtime.getRuntime().exec("notepad"); } catch (Exception e ){ e.printStackTrace(); } } } public class RunCmd { public static void main (String args[])throws Exception { Thread t= new Thread (new Cmd()); t.setDaemon (true); t.start(); t.join(); }}
class Cmd implements Runnable {
public void run () {
try {
Runtime.getRuntime().exec("notepad");
} catch (Exception e ){
e.printStackTrace();
}
}
}
public class RunCmd {
public static void main (String args[])throws Exception {
Thread t= new Thread (new Cmd());
t.setDaemon (true);
t.start();
t.join();
}}