一、写在前面
1.Centos版本:CentOS Linux release 7.3.1611 (Core) x86_64
2.ant版本:apache-ant-1.9.13
3.freetype版本:freetype-2.3.12
4.openjdk版本:openjdk-7u6-fcs-src-b24-28_aug_2012
5.jdk版本:jdk1.6.0_45
二、安装jdk必备软件包
yum -y groupinstall 'base'
yum -y install make
yum -y install alsa-lib-devel
yum -y install cups-devel
yum -y install libXi-devel
yum -y install gcc gcc-c++
yum -y install libX*
yum -y install libstdc++-static.i686
yum -y install libstdc++-static.x86_64
三、下载相关资源(存放到/mnt/application/tools中)
1.freetype-2.3.12.tar.gz
下载地址:https://sourceforge.net/projects/freetype/files/freetype2/2.3.12/freetype-2.3.12.tar.gz/download
2.apache-ant-1.9.13-bin.zip
下载地址:http://archive.apache.org/dist/ant/binaries/apache-ant-1.9.13-bin.zip
3.openjdk-7u6-fcs-src-b24-28_aug_2012.zip
下载地址:http://www.java.net/download/openjdk/jdk7/promoted/b24/openjdk-7u6-fcs-src-b24-28_aug_2012.zip
4.jdk-6u45-linux-x64.bin (存放到/mnt/application/java中)
下载地址:https://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html
备注:已将以上资源打包上传到CSDN:https://download.csdn.net/download/szstudy/10712108
四、编译安装配置环境
1.编译安装freetype:
[root@localhost tools]#tar -xzf freetype-2.3.12.tar.gz
[root@localhost tools]# cd freetype-2.3.12
[root@localhost freetype-2.3.12]#./configure
[root@localhost freetype-2.3.12]#make
[root@localhost freetype-2.3.12]#make install
2.安装JDK:
[root@localhost java]#chmod a+x jdk-6u45-linux-x64.bin
[root@localhost java]#./jdk-6u45-linux-x64.bin
配置环境变量(配置文件/etc/profile)
JAVA_HOME=/mnt/application/java/jdk1.6.0_45
export JRE_HOME=mnt/application/java/jdk1.6.0_45/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
使环境变量生效:
[root@localhost etc]#source profile
验证:
[root@localhost openjdk]# java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
3.安装ant:
[root@localhost tools]#unzip apache-ant-1.9.13-bin.zip
[root@localhost tools]#ln -s /mnt/application/tools/apache-ant-1.9.13/bin/ant /usr/bin/ant
验证:
[root@localhost tools]#ant
Buildfile: build.xml does not exist!
Build failed
4.配置环境变量(配置文件/etc/profile)
nset CLASSPATH
unset JAVA_HOME
export LANG=C
export ALT_BOOTDIR=/mnt/application/java/jdk1.6.0_45
export ANT_HOME=/mnt/application/tools/apache-ant-1.9.13/
export ALT_FREETYPE_LIB_PATH=/usr/local/lib
export SKIP_DEBUG_BUILD=false
export SKIP_FASTDEBUG_BUILD=true
export DEBUG_NAME=debug
export ALT_FREETYPE_HEADERS_PATH=/usr/local/include/freetype2
使环境变量生效:
[root@localhost etc]#source profile
5.修改/mnt/application/tool/openjdk/jdk/src/share/classes/java/util/CurrencyData.properties
修改108行
AZ=AZM;2009-12-31-20-00-00;AZN
修改381行
MZ=MZM;2009-06-30-22-00-00;MZN
修改443行
RO=ROL;2009-06-30-21-00-00;RON
修改535行
TR=TRL;2009-12-31-22-00-00;TRY
修改561行
VE=VEB;2009-01-01-04-00-00;VEF
6.检查环境
[root@localhost openjdk]# make sanity
....
....
....
....
Previous JDK Settings:
PREVIOUS_RELEASE_PATH = USING-PREVIOUS_RELEASE_IMAGE
ALT_PREVIOUS_RELEASE_PATH =
PREVIOUS_JDK_VERSION = 1.6.0
ALT_PREVIOUS_JDK_VERSION =
PREVIOUS_JDK_FILE =
ALT_PREVIOUS_JDK_FILE =
PREVIOUS_JRE_FILE =
ALT_PREVIOUS_JRE_FILE =
PREVIOUS_RELEASE_IMAGE = /mnt/application/java/jdk1.6.0_45
ALT_PREVIOUS_RELEASE_IMAGE =
Sanity check passed.
7.编译
[root@localhost openjdk]# make all
Build times ----------
Target debug_build
Start 2015-05-05 09:34:37
End 2015-05-05 10:24:33
00:05:23 corba
00:10:49 hotspot
00:00:55 jaxp
00:01:07 jaxws
00:30:05 jdk
00:01:36 langtools
00:49:56 TOTAL
-------------------------
make[1]: Leaving directory `/application/tools/openjdk'
8.查看是否编译成功
[root@localhost openjdk]# ./build/linux-amd64/bin/java -version
openjdk version "1.7.0-internal-debug"
OpenJDK Runtime Environment (build 1.7.0-internal-debug-root_2018_10_10_18_56-b00)
OpenJDK 64-Bit Server VM (build 23.2-b09-jvmg, mixed mode)
参考:http://www.cnblogs.com/myresearch/p/build-openjdk7.html