系统环境:centos 7.2 web 服务器版
1. 安装必备依赖
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 install libstdc++-static
2.下载软件
apache-ant-1.9.2-bin.tar.gz
freetype-2.4.12.tar.gz
jdk-7u79-linux-x64.gz
openjdk-7u40-fcs-src-b43-26_aug_2013.zip
3.编译freetype
解压 tar -zxvf freetype-2.4.12.tar.gz
cd freetype-2.4.12
./configure
make
make install
4.解压jdk(bootstrap jdk ,编译java文件使用)
解压 tar -zxvf jdk-7u79-linux-x64.gz /mnt/jdk7u79
vim /etc/profile 在文件结尾加入以下四项:
export JAVA_HOME= /mnt/jdk7u79
export JRE_HOME /mnt/jdk7u79/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
执行 source /etc/profile 生效
5.安装ant
unzip apache-ant-1.9.2
ln -s ./apache-ant-1.9.2/bin/ant /usr/bin/ant
6.处理openjdk源码
解压至openjdk unzip openjdk-7u40-fcs-src-b43-26_aug_2013.zip
更改时间:
vim ./openjdk/jdk/src/share/classes/java/util/CurrencyData.properties更改所有时间为十年内时间
否则编译时会报异常
去除&&/test_gamma
vim ./openjdk/hotspot/make/linux/MakeFile
删除其中所有的test_gamma,不然编译会因为这个通不过
7.设置当前环境变量
unset CLASSPATH
unset JAVA_HOME
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
export ALT_BOOTDIR=/mnt/jdk7u79
export ANT_HOME=/applications/tools/apache-ant-1.9.2
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
8.检查编译环境(切换至openjdk目录)
make sanity
----------
------
Sanity check passed.----
8. 执行编译
make all
.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................经过漫长的等待,具体看电脑配置....................................................................................................
大功告成
cd ./openjdk/build/linux-amd64/bin
./java -version