Centos7编译openjdk7
Posted Longe.D
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7编译openjdk7相关的知识,希望对你有一定的参考价值。
准备环境:
操作系统: CentOS7 64位
openjdk、jdk、ant资源下载
链接:http://pan.baidu.com/s/1o7NzZKm 密码:c8sw
依赖资源安装
- 安装alsa包
yum install alsa-lib-devel - 安装cups-devel
yum install cups-devel - 安装X相关的库
yum install libX* - 安装g++
yum install gcc gcc-c++ - 安装freetype
yum install freetype-devel - 安装libstdc
yum install libstdc++-static - 安装ant
unzip apache-ant-1.8.2-bin.zip - 设置环境变量
unset CLASSPATH unset JAVA_HOME // 语言选项,必须设置 export LANG=C // Bootstrap JDK的安装路径,必须设置 export ALT_BOOTDIR=/opt/jdk1.7.0_60 // Ant的安装路径 export ANT_HOME=/opt/compile/apache-ant-1.8.2 // 允许自动下载依赖 export ALLOW_DOWNLOADS=true // 预编译 export USE_PRECOMPILED_HEADER=true // 64位jdk export ARCH_DATA_MODEL=64 // 并行编译的线程数,设置为和CPU内核数量一致即可 export HOTSPOT_BUILD_JOB=4 export ALT_PARALLEL_COMPILE_JOBS=4 // 编译内容 export SKIP_DEBUG_BUILD=false export SKIP_FASTDEBUG_BUILD=true export DEBUG_NAME=debug // 输出路径 export ALT_OUTPUTDIR=/opt/compile/build-jdk
- 解压openjdk-7u40-fcs-src-b43-26_aug_2013.zip
unzip openjdk-7u40-fcs-src-b43-26_aug_2013.zip - 编译检查
进入解压后的openjdk目录下执行命令:make sanity
若输出结果为:Sanity check passed
,表示检查通过 - 执行编译
执行命令:make,执行结束后如下,显示每个模块的编译所用时长: -
#-- Build times ---------- Target debug_build Start 2016-09-05 08:01:45 End 2016-09-05 08:38:17 00:03:31 corba 00:09:33 hotspot 00:00:36 jaxp 00:00:45 jaxws 00:20:55 jdk 00:01:12 langtools 00:36:32 TOTAL -------------------------
- 配置debug版jdk
/opt/compile/build-jdk-debug/j2sdk-image下内容为debug版jdk,将其复制到%JAVA_HOME%下,替换Oracle JDK。 - 查看jdk版本信息
[[email protected] ~]# java -version
openjdk version "1.7.0-internal-debug"
OpenJDK Runtime Environment (build 1.7.0-internal-debug-root_2016_09_05_07_41-b00)
OpenJDK 64-Bit Server VM (build 24.0-b56-jvmg, mixed mode)
问题 Error: time is more than 10 years from present: 1120165200000
Error: time is more than 10 years from present: 1120165200000
java.lang.RuntimeException: time is more than 10 years from present: 1120165200000
at build.tools.generatecurrencydata.GenerateCurrencyData.makeSpecialCaseEntry(GenerateCurrencyData.java:285)
at build.tools.generatecurrencydata.GenerateCurrencyData.buildMainAndSpecialCaseTables(GenerateCurrencyData.java:225)
at build.tools.generatecurrencydata.GenerateCurrencyData.main(GenerateCurrencyData.java:154)
make[5]: *** [/root/openjdk/build/../build-debug/lib/currency.data] Error 1
make[5]: Leaving directory `/root/Downloads/openjdk/jdk/make/java/java‘
make[4]: *** [all] Error 1
make[4]: Leaving directory `/root/Downloads/openjdk/jdk/make/java‘
make[3]: *** [all] Error 1
make[3]: Leaving directory `/root/Downloads/openjdk/jdk/make‘
make[2]: *** [jdk-build] Error 2
make[2]: Leaving directory `/root/Downloads/openjdk‘
make[1]: *** [generic_debug_build] Error 2
make[1]: Leaving directory `/root/Downloads/openjdk‘
make: *** [build_debug_image] Error 2
解决方法:报错的位置是openjdk目录下jdk/src/share/classes/java/util/CurrencyData.properties文件,将此文件中所有的时间改为10年以内即可
以上是关于Centos7编译openjdk7的主要内容,如果未能解决你的问题,请参考以下文章