Windows涓嬭皟鐢ㄧ▼搴?/p>
Process proc =Runtime.getRuntime().exec("exefile");
Linux涓嬭皟鐢ㄧ▼搴忓氨瑕佹敼鎴愪笅闈㈢殑鏍煎紡
Process proc =Runtime.getRuntime().exec("./exefile");
Windows涓嬭皟鐢ㄧ郴緇熷懡浠?/p>
String [] cmd={"cmd","/C","dir"};
Process proc =Runtime.getRuntime().exec(cmd);
Linux涓嬭皟鐢ㄧ郴緇熷懡浠ゅ氨瑕佹敼鎴愪笅闈㈢殑鏍煎紡
String [] cmd={"/bin/sh","-c","ln -s exe1 exe2"};
Process proc =Runtime.getRuntime().exec(cmd);
Windows涓嬭皟鐢ㄧ郴緇熷懡浠ゅ茍寮瑰嚭鍛戒護琛岀獥鍙?/p>
String [] cmd={"cmd","/C","start copy exe1 exe2"};
Process proc =Runtime.getRuntime().exec(cmd);
Linux涓嬭皟鐢ㄧ郴緇熷懡浠ゅ茍寮瑰嚭緇堢紿楀彛灝辮鏀規垚涓嬮潰鐨勬牸寮?/p>
String [] cmd={"/bin/sh","-c","xterm -e ln -s exe1 exe2"};
Process proc =Runtime.getRuntime().exec(cmd);
榪樻湁瑕佽緗皟鐢ㄧ▼搴忕殑宸ヤ綔鐩綍灝辮
Process proc =Runtime.getRuntime().exec("exeflie",null, new File("workpath"))ProcessBuilder ;
鍚岀悊錛?div>ProcessBuilder涔熷彲浠ヨ繖涔堜嬌鐢ㄧ閬?錛屼嬌鐢?|
ProcessBuilder builder = new ProcessBuilder("/bin/sh","-c","ps aux |grep java");

]]>