记录一下openjdk的编译吧!

系统环境:win10
之前已经启用了linux bash环境

前置准备:本地下载好openjdk12,地址http://hg.openjdk.java.net/jdk/jdk12/file/06222165c35f

下载其实是可以看到本地~\jdk12-06222165c35f\doc下有几个文件比如:building.html

里面有写步骤和一些环境需要的东西

步骤
Get the complete source code:
hg clone http://hg.openjdk.java.net/jdk/jdk

Run configure:
bash configure

If configure fails due to missing dependencies (to either the toolchain, build tools, external libraries or the boot JDK), most of the time it prints a suggestion on how to resolve the situation on your platform. Follow the instructions, and try running bash configure again.

Run make:
make images

Verify your newly built JDK:
./build/*/images/jdk/bin/java -version

Run basic tests:
make run-test-tier1

其实,进入当前目录,敲下bash,然后bash configure,它会提示你缺什么,然后你去下载就可以了,参考这个https://my.oschina.net/amhuman/blog/848508

其中我遇到了一个问题,就是请求的网址404,详见https://www.cnblogs.com/X-knight/p/10598076.html

我先试了第二种方法,也就是网络问题,很快就解决了。(文件的修改需要懂基本的linux文件读写)

然后它的编译还需要鸡生蛋,蛋生鸡,我就sudo apt-get install openjdk-11-jdk

接着按照官方提示make images,我先是make的(花了半小时),然后找不到在哪里java -version...,后来就make images(这时速度就很快了)
然后继续./build/*/images/jdk/bin/java -version
结果如下

angelica@LAPTOP-VJ3VKQJ5:/mnt/d/software/Java/jdk12-06222165c35f$ ./build/linux-x86_64-server-release/images/jdk/bin/java -version
openjdk version "12-internal" 2019-03-19
OpenJDK Runtime Environment (build 12-internal+0-adhoc.angelica.jdk12-06222165c35f)
OpenJDK 64-Bit Server VM (build 12-internal+0-adhoc.angelica.jdk12-06222165c35f, mixed mode, sharing)

确定是我下载的jdk12了!

posted @ 2020-08-01 14:17  白芷呀  阅读(225)  评论(0编辑  收藏  举报