编译openjdk
http://blog.csdn.net/rongyongfeikai2/article/details/51137533 CentOS7手动编译OpenJDK
https://www.cnblogs.com/mr-long/p/5841604.html
https://www.cnblogs.com/ACFLOOD/p/5528035.html openjdk安装
http://blog.csdn.net/hl_java/article/details/76691321 老司机手把手教你自己编译jdk
http://blog.51cto.com/13266852/1962186 问题答案
http://blog.csdn.net/u010349169/article/category/2620885 Java虚拟机原理图解
环境:
操作系统:CentOS Linux release 7.4.1708 (Core)
计划编译的jdk: openjdk7 jdk7u
Bootstrap JDK: java version “1.7.0_80”
编译需要的软件:
yum install -y mercurial
yum install -y libX11* libX*
yum install -y libXi-devel libXtst-devel libXt-devel freetype*
yum install -y alsa-lib-devel cups-devel
yum install -y gcc gcc-c++
yum install libstdc++-static 或者 yum install glibc-static libstdc++-static
安装ant 1.7.1以上
安装jdk1.7.0_80
获取编译的源(openjdk7)
hg clone http://hg.openjdk.java.net/jdk7u/jdk7u
cd jdk7u
chmod 755 get_source.sh
./get_source.sh
**配置环境变量
**
vi ~/.bashrc
export LANG=C
export ALT_BOOTDIR=/usr/java/jdk1.7.0_80/
export ALLOW_DOWNLOADS=true
export HOTSPOT_BUILD_JOBS=4
export ALT_PATALLER_COMPILE_JOBS=4
export SKIP_COMPARE_IMAGES=true
export USE_PRECOMPILED_HEADER=true
export BUILD_LANGTOOLS=true
export BUILD_HOTSPOT=true
export BUILD_JDK=true
export BUILD_JAXP=true
export BUILD_JAXWS=true
export BUILD_CORBA=true
#export SKIP_DEBUG_BUILD=false
#export SKIP_FASTDEBUG_BUILD=true
BUILD_DEPLOY=false
BUILD_INSTALL=false
export ALT_OUTPUTDIR=/root/temp/jdk7u
#export CORBA_DIST=$ALT_OUTPUTDIR/corba/dist
#export JAXP_DIST=$ALT_OUTPUTDIR/jaxp/dist
#export JAXWS_DIST=$ALT_OUTPUTDIR/jaxws/dist
export ANT_HOME=/root/apache-ant-1.8.0
export ALT_FREETYPE_HEADERS_PATH=/usr/include/freetype2
export ALT_FREETYPE_LIB_PATH=/usr/lib64
unset JAVA_HOME
unset CLASSPATH
unset JAVA_OPTS
保存并source ~/.bashrc
编译前检查:
make sanity
编译:
make
测试编译的JDK:
进入编译的目录(export ALT_OUTPUTDIR=/root/temp/jdk7u)的bin目录,./java -version
显示下面内容说明编译成功:
openjdk version “1.7.0-internal”
OpenJDK Runtime Environment (build 1.7.0-internal-root_2017_08_04_17_21-b00)
OpenJDK 64-Bit Server VM (build 24.80-b07, mixed mode)
在eclipse上调试HotSpot虚拟机源码: