全网最新最简单的 OpenJDK13 代码编译

                <p><br></p><p class="" style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;margin-left: 25px;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);"><span class="" style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;display: block;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;">开始咯</span></span><span class="" style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;display: block;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;">1.下载源码</span></span></span><span class="" style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;display: block;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;">2.安装编译需要的依赖</span></span></span><span class="" style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;display: block;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;">3.安装 jdk 12</span></span></span><span class="" style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;display: block;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;">4.检查配置</span></span></span><span class="" style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;display: block;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;">5.开始编译</span></span></span><span class="" style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;display: block;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;">6.验证是否成功</span></span></span><span class="" style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;display: block;"><span class="" style="box-sizing: border-box;margin-left: 25px;font-size: inherit;color: inherit;line-height: inherit;">回顾</span></span></p><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">最近因写文章需要查看 JVM 源码,有时代码逻辑不是很清晰,找半天,趁国庆假期,抽空下载了 OpenJDK13 搭建了 JVM <wdautohl-customtag style="font-weight:bold;color:red;font-size:inherit;display:inline;" id="wdautohl_id_1" class="">debug</wdautohl-customtag> 环境,把操作记录写在这篇文章里,让有需要的朋友可以参考,少踩坑。</p><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">我是在 Ubuntu 18.04 下编译的,不是在 Windows,建议不在 Windows 下折腾,会遇到比在 Linux 环境下多得多的问题。如果你电脑也是 Windows,可以像我这样,安装个&nbsp;<strong style="box-sizing: border-box;color: inherit;font-size: inherit;line-height: inherit;">VMware</strong>&nbsp;虚拟机软件,在里面装个&nbsp;<strong style="box-sizing: border-box;color: inherit;font-size: inherit;line-height: inherit;">Ubuntu</strong>&nbsp;系统,在虚拟机里面玩,这 2 个软件在官网下载就行,当然如果懒得去找也可以<code style="box-sizing: border-box;margin-right: 2px;margin-left: 2px;padding: 2px 4px;font-size: inherit;color: rgb(95, 156, 239);line-height: inherit;overflow-wrap: break-word;border-radius: 4px;background: rgb(248, 248, 248);">在我的公众号后台回复: 虚拟机</code>&nbsp;获取&nbsp;<strong style="box-sizing: border-box;color: inherit;font-size: inherit;line-height: inherit;">VMware</strong>&nbsp;软件和&nbsp;<strong style="box-sizing: border-box;color: inherit;font-size: inherit;line-height: inherit;">Ubuntu 18.04</strong>&nbsp;镜像。</p><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">安装 Ubuntu 虚拟机就不在这篇文章说了,网上有相关的资料。</p><h2 style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;font-weight: bold;font-size: 1.4em;color: rgb(67, 144, 87);line-height: inherit;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 1px;text-align: start;white-space: normal;word-spacing: 2px;background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;">开始咯</span></h2><h3 style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;font-weight: bold;font-size: 1.3em;color: rgb(67, 144, 87);line-height: inherit;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 1px;text-align: start;white-space: normal;word-spacing: 2px;background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;">1.下载源码</span></h3><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">平时咱用的代码管理工具大多数是 Git,OpenJDK 并不是,而是用 <wdautohl-customtag style="font-weight:bold;color:red;font-size:inherit;display:inline;" id="wdautohl_id_2" class="">Mercurial</wdautohl-customtag> 管理工具,所以我们要安装它。通过下面命令安装。</p><pre style="box-sizing: border-box;color: rgb(62, 62, 62);line-height: inherit;letter-spacing: 1px;text-align: start;word-spacing: 2px;background-color: rgb(255, 255, 255);"><code class="hljs cmake" style="box-sizing: border-box;margin-right: 2px;margin-left: 2px;padding: 0.5em;font-size: 14px;color: rgb(169, 183, 198);line-height: 17px;border-radius: 0px;background: rgb(40, 43, 46);display: block;font-family: Consolas, Inconsolata, Courier, monospace;overflow-x: auto;word-spacing: 0px;letter-spacing: 0px;overflow-wrap: normal !important;word-break: normal !important;overflow-y: auto !important;">sudo&nbsp;apt-<span class="" style="box-sizing: border-box;font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;">get</span>&nbsp;<span class="hljs-keyword"><span class="hljs-keyword">install</span></span>&nbsp;mercurial<br style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"></code></pre><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">安装完代码管理工具后,我们就可以下载 OpenJDK13 的源码了,使用如下命令即可下载。这个过程根据网络状况,需要的时间不一,我下载花了十来分钟。</p><pre style="box-sizing: border-box;color: rgb(62, 62, 62);line-height: inherit;letter-spacing: 1px;text-align: start;word-spacing: 2px;background-color: rgb(255, 255, 255);"><code class="hljs groovy" style="box-sizing: border-box;margin-right: 2px;margin-left: 2px;padding: 0.5em;font-size: 14px;color: rgb(169, 183, 198);line-height: 17px;border-radius: 0px;background: rgb(40, 43, 46);display: block;font-family: Consolas, Inconsolata, Courier, monospace;overflow-x: auto;word-spacing: 0px;letter-spacing: 0px;overflow-wrap: normal !important;word-break: normal !important;overflow-y: auto !important;"><span class="" style="box-sizing: border-box;font-size: inherit;color: rgb(238, 220, 112);line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;">hg</span>&nbsp;clone&nbsp;<span class="hljs-string"><span class="hljs-string">http:</span></span><span class="hljs-comment"><span class="hljs-comment">//hg.openjdk.java.net/jdk/jdk13/</span></span><br style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"></code></pre><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">嗯,我就是这样干等了十来分钟,因为具体的官方操作文档也在里面,没下载下来无法看,网上也找不到相关的 Ubuntu 18 编译 OpenJDK13 的文章,所以不知道具体要安装哪些依赖。<strong style="box-sizing: border-box;color: inherit;font-size: inherit;line-height: inherit;">现在你看到这篇文章,可以不用干等着了,接下来步骤 2 和 3 不依赖源代码,可以继续操作。</strong></p><h3 style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;font-weight: bold;font-size: 1.3em;color: rgb(67, 144, 87);line-height: inherit;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 1px;text-align: start;white-space: normal;word-spacing: 2px;background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;">2.安装编译需要的依赖</span></h3><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">这一部分是查看了官方文档,做了总结,官方文档里面是按软件区分的,那样一个命令一个命令敲有点繁琐,就把它整合成一个命令,执行就完了,满足有些朋友想尽快编译完,少些多余的东西。</p><pre style="box-sizing: border-box;color: rgb(62, 62, 62);line-height: inherit;letter-spacing: 1px;text-align: start;word-spacing: 2px;background-color: rgb(255, 255, 255);"><code class="hljs cmake" style="box-sizing: border-box;margin-right: 2px;margin-left: 2px;padding: 0.5em;font-size: 14px;color: rgb(169, 183, 198);line-height: 17px;border-radius: 0px;background: rgb(40, 43, 46);display: block;font-family: Consolas, Inconsolata, Courier, monospace;overflow-x: auto;word-spacing: 0px;letter-spacing: 0px;overflow-wrap: normal !important;word-break: normal !important;overflow-y: auto !important;">sudo&nbsp;apt-<span class="" style="box-sizing: border-box;font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;">get</span>&nbsp;<span class="hljs-keyword"><span class="hljs-keyword">install</span></span>&nbsp;libfreetype6-dev&nbsp;libcups2-dev&nbsp;libx11-dev&nbsp;libxext-dev&nbsp;libxrender-dev&nbsp;libxrandr-dev&nbsp;libxtst-dev&nbsp;libxt-dev&nbsp;libasound2-dev&nbsp;libffi-dev&nbsp;autoconf&nbsp;gcc&nbsp;clang&nbsp;libfontconfig1-dev<br style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"></code></pre><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">想了解这些依赖软件是干嘛用的,可以看看官方文档,文档的位置如下图。</p><figure style="box-sizing: border-box;color: rgb(62, 62, 62);line-height: inherit;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 1px;text-align: start;white-space: normal;word-spacing: 2px;background-color: rgb(255, 255, 255);"><img class="" data-ratio="0.3167701863354037" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/fd61V9Z6XiaZiavarGEZzUlYyJcNxteYTuD9HUicv3Jr8ticqwaFmxvvMdUZS3KqmmkbDyYr10rpX8GerRd59cdGDQ/640?wx_fmt=jpeg" data-type="jpeg" data-w="644" style="box-sizing: border-box; margin-right: auto; margin-left: auto; border- 2px; border-style: solid; border-color: rgb(238, 238, 238); border-radius: 6px; font-size: inherit; color: inherit; line-height: inherit; display: block;  644px !important; height: auto !important; visibility: visible !important;" title="" _width="644px" src="https://img2018.cnblogs.com/blog/1112483/201910/1112483-20191009124837803-914157576.png" crossorigin="anonymous" data-fail="0"></figure><h3 style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;font-weight: bold;font-size: 1.3em;color: rgb(67, 144, 87);line-height: inherit;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 1px;text-align: start;white-space: normal;word-spacing: 2px;background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;">3.安装 jdk 12</span></h3><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">这个在文档里面称为&nbsp;<strong style="box-sizing: border-box;color: inherit;font-size: inherit;line-height: inherit;">Boot JDK</strong>,就是编译时需要上一个版本的 JDK 做为基础,一般是使用 N-1 版本,比如编译 OpenJDK8 就使用 JDK7 作为 Boot JDK,我们这里是编译 OpenJDK13,所以使用的是 JDK12。也是执行下面命令就搞定。</p><pre style="box-sizing: border-box;color: rgb(62, 62, 62);line-height: inherit;letter-spacing: 1px;text-align: start;word-spacing: 2px;background-color: rgb(255, 255, 255);"><code class="hljs cs" style="box-sizing: border-box;margin-right: 2px;margin-left: 2px;padding: 0.5em;font-size: 14px;color: rgb(169, 183, 198);line-height: 17px;border-radius: 0px;background: rgb(40, 43, 46);display: block;font-family: Consolas, Inconsolata, Courier, monospace;overflow-x: auto;word-spacing: 0px;letter-spacing: 0px;overflow-wrap: normal !important;word-break: normal !important;overflow-y: auto !important;">sudo&nbsp;<span class="" style="box-sizing: border-box;font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="hljs-keyword"><span class="hljs-keyword">add</span></span></span>-apt-repository&nbsp;ppa:openjdk-r/ppa<br style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;">sudo&nbsp;apt-<span class="" style="box-sizing: border-box;font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="hljs-keyword"><span class="hljs-keyword">get</span></span></span>&nbsp;update<br style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;">sudo&nbsp;apt-<span class="" style="box-sizing: border-box;font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="hljs-keyword"><span class="hljs-keyword">get</span></span></span>&nbsp;install&nbsp;openjdk<span class="" style="box-sizing: border-box;font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="hljs-number"><span class="hljs-number">-12</span></span></span>-jdk<br style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"></code></pre><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">安装完可以通过&nbsp;<code style="box-sizing: border-box;margin-right: 2px;margin-left: 2px;padding: 2px 4px;font-size: inherit;color: rgb(95, 156, 239);line-height: inherit;overflow-wrap: break-word;border-radius: 4px;background: rgb(248, 248, 248);">java -version</code>&nbsp;来验证一下是否成功安装。见到如下结果就妥妥的。</p><figure style="box-sizing: border-box;color: rgb(62, 62, 62);line-height: inherit;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 1px;text-align: start;white-space: normal;word-spacing: 2px;background-color: rgb(255, 255, 255);"><img class="" data-ratio="0.12693498452012383" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/fd61V9Z6XiaZiavarGEZzUlYyJcNxteYTuzZ5TlwP7njt4bdRlpaSPodhDibTDQh4Ojvn1GllTUfOtugUeugjTfcg/640?wx_fmt=jpeg" data-type="jpeg" data-w="646" style="box-sizing: border-box; margin-right: auto; margin-left: auto; border- 2px; border-style: solid; border-color: rgb(238, 238, 238); border-radius: 6px; font-size: inherit; color: inherit; line-height: inherit; display: block;  646px !important; height: auto !important; visibility: visible !important;" title="" _width="646px" src="https://img2018.cnblogs.com/blog/1112483/201910/1112483-20191009124857035-570528350.png" crossorigin="anonymous" data-fail="0"></figure><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">执行完上面步骤,那么恭喜你,现在就可以开始编译了。</p><h3 style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;font-weight: bold;font-size: 1.3em;color: rgb(67, 144, 87);line-height: inherit;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 1px;text-align: start;white-space: normal;word-spacing: 2px;background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;">4.检查配置</span></h3><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">我们安装了上面那么多东西,需要来检查一下是不是已经安装完所需要的软件,通过下面命令来检查。</p><pre style="box-sizing: border-box;color: rgb(62, 62, 62);line-height: inherit;letter-spacing: 1px;text-align: start;word-spacing: 2px;background-color: rgb(255, 255, 255);"><code class="hljs nginx" style="box-sizing: border-box;margin-right: 2px;margin-left: 2px;padding: 0.5em;font-size: 14px;color: rgb(169, 183, 198);line-height: 17px;border-radius: 0px;background: rgb(40, 43, 46);display: block;font-family: Consolas, Inconsolata, Courier, monospace;overflow-x: auto;word-spacing: 0px;letter-spacing: 0px;overflow-wrap: normal !important;word-break: normal !important;overflow-y: auto !important;"><span class="" style="box-sizing: border-box;font-size: inherit;color: rgb(238, 220, 112);line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="hljs-attribute"><span class="hljs-attribute">bash</span></span></span>&nbsp;configure<br style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"></code></pre><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">如果执行过程中有异常,就根据异常和提示信息,安装所缺的软件就行。如果看到下面的结果,那么再一次恭喜你,所有依赖软件都准备好了。</p><figure style="box-sizing: border-box;color: rgb(62, 62, 62);line-height: inherit;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 1px;text-align: start;white-space: normal;word-spacing: 2px;background-color: rgb(255, 255, 255);"><img class="" data-ratio="0.46075433231396534" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/fd61V9Z6XiaZiavarGEZzUlYyJcNxteYTu5OSIlan0eibEqKqoyA5awicSY7yLBH4stiaXLnH1nqduaY0yrDuOBVopg/640?wx_fmt=jpeg" data-type="jpeg" data-w="981" style="box-sizing: border-box; margin-right: auto; margin-left: auto; border- 2px; border-style: solid; border-color: rgb(238, 238, 238); border-radius: 6px; font-size: inherit; color: inherit; line-height: inherit; display: block;  677px !important; height: auto !important; visibility: visible !important;" title="" _width="677px" src="https://img2018.cnblogs.com/blog/1112483/201910/1112483-20191009124917705-1169133672.png" crossorigin="anonymous" data-fail="0"></figure><h3 style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;font-weight: bold;font-size: 1.3em;color: rgb(67, 144, 87);line-height: inherit;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 1px;text-align: start;white-space: normal;word-spacing: 2px;background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;">5.开始编译</span></h3><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">最激动人心的时刻到来了,敲入下面的命令,开始编译吧。这个过程大概需要半个小时,耐心等候,可以稍作休息,喝杯 82 年的咖啡。</p><pre style="box-sizing: border-box;color: rgb(62, 62, 62);line-height: inherit;letter-spacing: 1px;text-align: start;word-spacing: 2px;background-color: rgb(255, 255, 255);"><code class="hljs go" style="box-sizing: border-box;margin-right: 2px;margin-left: 2px;padding: 0.5em;font-size: 14px;color: rgb(169, 183, 198);line-height: 17px;border-radius: 0px;background: rgb(40, 43, 46);display: block;font-family: Consolas, Inconsolata, Courier, monospace;overflow-x: auto;word-spacing: 0px;letter-spacing: 0px;overflow-wrap: normal !important;word-break: normal !important;overflow-y: auto !important;"><span class="" style="box-sizing: border-box;font-size: inherit;color: rgb(238, 220, 112);line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="hljs-built_in"><span class="hljs-built_in">make</span></span></span>&nbsp;images<br style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"></code></pre><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">见证奇迹的图片。看到下图说明编译成功啦。</p><figure style="box-sizing: border-box;color: rgb(62, 62, 62);line-height: inherit;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 1px;text-align: start;white-space: normal;word-spacing: 2px;background-color: rgb(255, 255, 255);"><img class="" data-ratio="0.6594488188976378" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/fd61V9Z6XiaZiavarGEZzUlYyJcNxteYTuyjXaICd32fYZD79NTjtKKVHBZkXb5nmGAVMDfC8VusnxSc3QOt0oZA/640?wx_fmt=jpeg" data-type="jpeg" data-w="1016" style="box-sizing: border-box; margin-right: auto; margin-left: auto; border- 2px; border-style: solid; border-color: rgb(238, 238, 238); border-radius: 6px; font-size: inherit; color: inherit; line-height: inherit; display: block;  677px !important; height: auto !important; visibility: visible !important;" title="" _width="677px" src="https://img2018.cnblogs.com/blog/1112483/201910/1112483-20191009124934477-546758210.png" crossorigin="anonymous" data-fail="0"></figure><h3 style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;font-weight: bold;font-size: 1.3em;color: rgb(67, 144, 87);line-height: inherit;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 1px;text-align: start;white-space: normal;word-spacing: 2px;background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;">6.验证是否成功</span></h3><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">还需要再稳一点,验证编译后的 java 是否可用,通过下面的命令来验证。</p><pre style="box-sizing: border-box;color: rgb(62, 62, 62);line-height: inherit;letter-spacing: 1px;text-align: start;word-spacing: 2px;background-color: rgb(255, 255, 255);"><code class="hljs groovy" style="box-sizing: border-box;margin-right: 2px;margin-left: 2px;padding: 0.5em;font-size: 14px;color: rgb(169, 183, 198);line-height: 17px;border-radius: 0px;background: rgb(40, 43, 46);display: block;font-family: Consolas, Inconsolata, Courier, monospace;overflow-x: auto;word-spacing: 0px;letter-spacing: 0px;overflow-wrap: normal !important;word-break: normal !important;overflow-y: auto !important;">.<span class="hljs-regexp"><span class="hljs-regexp">/build/</span></span>*<span class="" style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="hljs-regexp"><span class="hljs-regexp">/images/</span></span>jdk</span><span class="" style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="hljs-regexp"><span class="hljs-regexp">/bin/</span></span>java</span>&nbsp;-version<br style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;overflow-wrap: inherit !important;word-break: inherit !important;"></code></pre><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">看下图,出现&nbsp;<code style="box-sizing: border-box;margin-right: 2px;margin-left: 2px;padding: 2px 4px;font-size: inherit;color: rgb(95, 156, 239);line-height: inherit;overflow-wrap: break-word;border-radius: 4px;background: rgb(248, 248, 248);">"13-internal" 2019-09-17</code>&nbsp;字样,我们编译出来的 JDK13 可以用啦。<br style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;"></p><figure style="box-sizing: border-box;color: rgb(62, 62, 62);line-height: inherit;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 1px;text-align: start;white-space: normal;word-spacing: 2px;background-color: rgb(255, 255, 255);"><img class="" data-ratio="0.08705612829324169" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/fd61V9Z6XiaZiavarGEZzUlYyJcNxteYTuCCWbHjVqxnM7w1LP1ljK4hwCIrwEiaLb7cNz4QlL7S18McTtoATyAWw/640?wx_fmt=jpeg" data-type="jpeg" data-w="873" style="box-sizing: border-box; margin-right: auto; margin-left: auto; border- 2px; border-style: solid; border-color: rgb(238, 238, 238); border-radius: 6px; font-size: inherit; color: inherit; line-height: inherit; display: block;  677px !important; height: auto !important; visibility: visible !important;" title="" _width="677px" src="https://img2018.cnblogs.com/blog/1112483/201910/1112483-20191009125003000-2132792319.png" crossorigin="anonymous" data-fail="0"></figure><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">这标题起得不过分吧,上面版本日期是&nbsp;<strong style="box-sizing: border-box;color: inherit;font-size: inherit;line-height: inherit;">2019-09-17</strong>,还不到一个月,网上相关资料也没,就只有官方文档了(当然也是最好的资料)。<code style="box-sizing: border-box;margin-right: 2px;margin-left: 2px;padding: 2px 4px;font-size: inherit;color: rgb(95, 156, 239);line-height: inherit;overflow-wrap: break-word;border-radius: 4px;background: rgb(248, 248, 248);">跟着步骤走,不会丢</code>,为了验证这句话,还把上面的步骤在我快退休的笔记本上跑了一遍,妥妥的。</p><h2 style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;font-weight: bold;font-size: 1.4em;color: rgb(67, 144, 87);line-height: inherit;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 1px;text-align: start;white-space: normal;word-spacing: 2px;background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box;font-size: inherit;color: inherit;line-height: inherit;">回顾</span></h2><p style="box-sizing: border-box;margin-top: 1.5em;margin-bottom: 1.5em;color: rgb(62, 62, 62);line-height: 2;word-spacing: 2px;letter-spacing: 1px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">我们这篇文章就讲了编译 OpenJDK13,接下来会再写一篇怎么搭建 <wdautohl-customtag style="font-weight:bold;color:red;font-size:inherit;display:inline;" id="wdautohl_id_3" class="">Debug</wdautohl-customtag> JVM 环境,可以关注公众号,期待下一篇。</p><section style="text-align: center;box-sizing: border-box;" powered-by="xiumi.us"><section style="max- 100%;display: inline-block;line-height: 0; 100%;box-sizing: border-box;"><img class="" data-ratio="0.0859375" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/fd61V9Z6XiabyxiclWmq8lj2VKKwvVRpZLAFgdMnicRH6tGBictNtacfznmJ99hTDGx85wNfcibwzGQKFBs7Q8UibASA/640?wx_fmt=jpeg" data-type="jpeg" data-w="640" style="vertical-align: middle; box-sizing: border-box;  100% !important; height: auto !important; visibility: visible !important;" _width="100%" src="https://img2018.cnblogs.com/blog/1112483/201910/1112483-20191009125026598-1121579836.png" crossorigin="anonymous" data-fail="0"></section></section><section style="line-height: 2;padding-right: 5px;padding-left: 5px;box-sizing: border-box;" powered-by="xiumi.us"></section>
           原文地址:https://mp.weixin.qq.com/s/5gO0YJZB7huG9cOByH5Qow </div>
原文地址:https://www.cnblogs.com/jpfss/p/11641060.html