調用java:
Runtime hello=Runtime.getRuntime(); //Runtime構造函數私有,只能通過這種方式獲得實例。 hello.exec("cmd /c start Java -D org.apache.axis.wsdl.WSDL2Java http://www./samples/hellowsdl2.php?wsdl");
調用javac: com.sun.tools.javac.Main javac = new com.sun.tools.javac.Main(); //這個包在tools.jar中。 String[] cpargs = new String[] {"-d", "所在目錄","Temp.java"}; int status = javac.compile(cpargs); if(status!=0){ System.out.println("沒有成功編譯源文件!"); return null; }
|