===== 环境 ===== * centos 6.7 * jdk 1.7 == 第一步:安装 hg == sudo yum install hg == 第2步:下载源码,多下载几次,经常失败 == * hg clone http://hg.openjdk.java.net/jdk7/jdk7 myjdk7 * sh ./get_source.sh == 第3步:安装系统依赖 == sudo yum install gcc gcc-c++ libXt-devel libXtst-devel libXrender-devel alsa* cups* ant ant-* freetype-devel.x86_64 gcc (4.4.7) == 第3步:修改时间 == vim ./jdk/src/share/classes/java/util/CurrencyData.properties 将如下时间修改到距离当前10年内 AZ=AZM;2005-12-31-20-00-00;AZN MZ=MZM;2006-06-30-22-00-00;MZN RO=ROL;2005-06-30-21-00-00;RON TR=TRL;2004-12-31-22-00-00;TRY VE=VEB;2008-01-01-04-00-00;VEF == 第4步:去掉测试 == vim hotspot/make/linux/Makefile 将包含test_gamma的行全部删除 == 第5步:删除 jaf,jaxp,jaxws模块 == * mkdir drop_dir * cd drop_dir * wget http://download.java.net/glassfish/components/jax-ws/openjdk/jdk7/jdk7-jaxws2_2_4-b03-2011_05_27.zip * wget ftp://ftp.usa.openbsd.org/pub/OpenBSD/distfiles/jdk/jdk7-jaf-2010_08_19.zip * wget ftp://ftp.usa.openbsd.org/pub/OpenBSD/distfiles/jdk/jaxp145_01.zip == 第6步:设置环境变量 == export LANG=C export ALT_BOOTDIR=/usr/local/jdk1.7.0_80/bin/java export BUILD_HOTSPOT=true export BUILD_JDK=true export BUILD_LANGTOOLS=true # skip jaxws #export BUILD_JAXWS=false # skip jaxp #export BUILD_JAXP=false # skip corba #export BUILD_CORBA=false export SKIP_COMPARE_IMAGES=true BUILD_DEPLOY=false BUILD_INSTALL=false export ARCH_DATA_MODEL=64 export ALLOW_DOWNLOADS=true unset JAVA_HOME unset CLASSPATH == 第7步:开始编译 == 编译命令 sudo make ALT_BOOTDIR=/usr/local/jdk1.7.0_80 ALLOW_DOWNLOADS=true ALT_DROPS_DIR=/home/hadoop/myjdk7/drop_dir ===== 编译完之后 ===== * jdk目录:myjdk7/build/linux-amd64/j2sdk-image/ * hotspot目录:myjdk7/build/linux-amd64/hotspot/outputdir/linux_amd64_compiler2/