centos7下编译openjdk11

源码

https://github.com/unofficial-openjdk/openjdk/releases

直接下载特定的版本jdk-11+28

 

编译环境centos7

 

unzip jdk11xxx.zip

cd jdk11xxx

#安装文档中描述的外部库要求(External Library Requirements)

yum install -y freetype-devel cups-devel libXtst-devel libXt-devel libXrender-devel libXi-devel alsa-lib-devel libffi-devel

#安装Build Tools Requirements

yum install -y autoconf

#提示缺少unzip,安装之

yum install -y unzip zip

#再次执行./configure提示configure: Could not find a valid Boot JDK. You might be able to fix this by running 'sudo yum install java-1.8.0-openjdk-devel'.

#尝试 yum install -y java-1.8.0-openjdk-devel

#但发现依然各种错误,提示需要10或者11,yum search openjdk-devel只有11

#详细原因参见Boot JDK Requirements

yum install -y java-11-openjdk-devel

#再次执行提示缺少gcc,建议安装开发工具包

yum groupinstall "Development Tools"

#再次执行提示缺少fontconfig

yum install -y fontconfig-devel

 

 

chmod 777 configure

./configure

make

 

编译成功提示:

Stopping sjavac server

Finished building target 'default (exploded-image)' in configuration 'linux-x86_64-normal-server-release'

 

 

此时,在jdk11/build/linux-x86_64-normal-server-release目录下,有个jdk目录,这里面就是最新构建的OpenJDK,进入里面的bin目录,再执行命令./java -version

 

你可能感兴趣的:(java)