我想运行NewCl.java,它是我当前包的一类,但是我无法弄清楚如何做到这一点。我在Eclipse中找到了很多方法,但是我想在Netbeans中做到这一点。这段代码有什么问题?
String [] command = {"java","-cp",".\\build\\classes","NewCl",String.valueOf(num2),String.valueOf(num1)};
ProcessBuilder pb = new ProcessBuilder(command);
System.out.println();
Process p = null;
答案 0 :(得分:0)
好的,我找到了解决方案。如果有人需要,这就是解决方案:
String [] command = {"java",
"-cp",
System.getProperty("java.class.path"),
"testing.NewCl", /*packagename + class*/
String.valueOf(num2),/*Useless for you*/
String.valueOf(num1)}; /*Useless for you*/