ubuntu20.04编译openjdk8

1. 下载jdk1.7

Java Archive Downloads - Java SE 7

解压tar -xvzf,移动到/usr/lib/jvm/下

2、hg clone http://hg.openjdk.java.net/jdk8u/jdk8u-dev;cd jdk8u-dev;sh get_source.sh

3、添加环境变量

export LANG=C

export PATH="/usr/lib/jvm/jdk1.7.0_80/bin:${PATH}"

4、bash ./configure

报错configure: error: Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). You might be able to fix this by running 'sudo apt-get install libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev'.

configure exiting with result code 1

安装缺少的依赖包

sudo apt-get install libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev

重新bash ./configure

报错configure: error: Could not find cups! You might be able to fix this by running 'sudo apt-get install libcups2-dev'

安装sudo apt-get install libcups2-dev

重新bash ./configure

报错configure: error: Could not find freetype! You might be able to fix this by running 'sudo apt-get install libfreetype6-dev'

安装sudo apt-get install libfreetype6-dev

重新bash ./configure

报错configure: error: Could not find alsa! You might be able to fix this by running 'sudo apt-get install libasound2-dev'

安装sudo apt-get install libasound2-dev

重新bash ./configure

configure: error: Could not find fontconfig! You might be able to fix this by running 'sudo apt-get install libfontconfig1-dev'.

configure exiting with result code 1

安装 sudo apt-get install libfontconfig1-dev

重新bash ./configure

/home/wl/openjdk8/jdk8u-dev/hotspot/src/os/linux/vm/os_linux.cpp:4993:15: error: '%s' directive argument is null [-Werror=format-overflow=]

4993 |     tty->print("Warning: %s handler ", exception_name(sig, buf, O_BUFLEN));

      |     ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1plus: all warnings being treated as errors

make[6]: *** [/home/wl/openjdk8/jdk8u-dev/hotspot/make/linux/makefiles/rules.make:151: os_linux.o] Error 1

添加 

--with-extra-cflags=-Wno-error

--with-extra-cxxflags=-Wno-error

5、make all

6、编译成功后,在/home/wl/openjdk/jdk8u-dev/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin目录下,运行./java -version,输出

openjdk version "1.8.0-internal"

OpenJDK Runtime Environment (build 1.8.0-internal-l_2017_12_03_07_32-b00)

OpenJDK 64-Bit Server VM (build 25.71-b00, mixed mode)

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

kgduu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值