最近在研究java虚拟机,在自己实现编译openjdk的时候如何通过命令行获取jdk的源码呢,在linux环境或者在win下的cygwin中,如下操作。
- Install mercurial to
/usr/bin
. - Go to directory you want to download jdk8 sources.
- Run there:
hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/
cd jdk8u/
chmod +x get_source.sh
LANG=C
./get_source.sh
- Make some coffee.
- Read built-in README-builds.html (located in the
jdk8u
as stated in this example) in order to build sources from received data, depending on your system. - Enjoy.