import javax.tools.*;
import java.io.*;
/**
* @author hardneedl
*/
final public class MyCompile {
/**
* @param args 命令行参数只有1个,即待编译的源代码文件的绝对路径
* @throws FileNotFoundException
*/
public static void main(String... args) throws FileNotFoundException {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
int r = compiler.run(null,null,null,args[0]);
System.out.println(r == 0? "成功":"失败");
}
}
追问run方法中最后一个参数是什么
追答待编译的源代码文件的绝对路径
追问那编译后的文件也在这个路径下放着么