package com.ps.test;
import java.io.IOException;
public class TestJar {
/**
* @param args
* java 调用自己写好的jar的方法
*/
public static void main(String[] args) {
try {
String[] strUpIp = { "cmd", "/c",
"start java -jar " + "D:/pengsong/6.jar"};
Runtime rt = Runtime.getRuntime();
rt.exec(strUpIp);
//也可以这么写
//Process pc = Runtime.getRuntime().exec("cmd /c start java -jar d:/pengsong/6.jar");
} catch (IOException e) {
e.printStackTrace();
}
}
}