Open JDK 编译器环境搭建

【Open JDK 编译器环境搭建】openjdk版本:jdk8-b120 github 传送门
javac路径:jdk-jdk8-b120\langtools\src\share\classes\com\sun\tools\javac
接下来ide(IDEA or Eclipse)创建Java空项目,把com整个文件夹移动到src,里面有javadoc等javac需要的依赖。
javac入口:com/sun/tools/javac/Main.java (开始debug~

public static void main(String[] args) throws Exception { System.exit(compile(args)); }//编译正常返回0 public static int compile(String[] args) { com.sun.tools.javac.main.Main compiler = new com.sun.tools.javac.main.Main("javac"); return compiler.compile(args).exitCode; }

    推荐阅读