1. 安装源码管理工具
yum install mercurial
2. 下载源码
hg clone http://hg.openjdk.java.net/jdk8u/jdk8u jdk8u #执行源码下载命令 sh get_source.sh
#jdk下载可能会报错
wget http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/archive/f0b93fbd8cf8.zip
3. 编译环境准备
yum -y install zlib zlib-devel yum -y install bzip2 bzip2-devel yum -y install ncurses ncurses-devel yum -y install readline readline-devel yum -y install openssl openssl-devel yum -y install openssl-static yum -y install xz lzma xz-devel yum -y install sqlite sqlite-devel yum -y install gdbm gdbm-devel yum -y install bzip2 bzip2-devel yum -y install ncurses ncurses-devel yum -y install readline readline-devel yum -y install openssl openssl-devel yum -y install openssl-static yum -y install xz lzma xz-devel yum -y install sqlite sqlite-devel yum -y install gdbm gdbm-devel yum -y install tk tk-devel yum -y install libffi-devel yum groupinstall "Development Tools" yum install libXtst-devel libXt-devel libXrender-devel yum install cups-devel yum install alsa-lib-devel cups-devel libX* gcc gcc-c++ freetype-devel libstdc++-static ant make yum install ccache
4. 编译配置
#给confiure赋予可执行权限 chmod +x configure ./configure --enable-debug
5. 编译
make clean (多次编译,清除之前的数据)
make
6. 测试用例测试
public class JvmTest { public static void main(String[] args) { System.out.println(System.getProperty("user.home")); System.out.println(System.getProperty("java.version")); System.out.println(System.getProperty("os.name")); System.out.println(System.getProperty("java.vendor.url")); } }