你再试试. public class T { public static void main(String[] args) throws Exception { if (args.length != 0) { String cmd = "cmd /c " + args[0]; Process pro = Runtime.getRuntime().exec(cmd); pro.waitFor(); }
} }D:\temp>java T c:/vtrans.logD:\temp>javac T.javaD:\temp>java T c:/vtrans.logD:\temp>java T c:/KAV2005D:\temp>java T f:/T.class注意保证你程序本身可以打开.
public class T
{
public static void main(String[] args) throws Exception
{
if (args.length != 0)
{
String cmd = "cmd /c " + args[0];
Process pro = Runtime.getRuntime().exec(cmd);
pro.waitFor();
}
}
}D:\temp>java T c:/vtrans.logD:\temp>javac T.javaD:\temp>java T c:/vtrans.logD:\temp>java T c:/KAV2005D:\temp>java T f:/T.class注意保证你程序本身可以打开.