版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/guolongpu/article/details/86502059
ubuntu 编译 jdk,本文的写作时间是2019.1.14.16。
我的编译环境:
Ubuntu 16.04 LTS 版本,在VMWare中。
JDK,OpenJDK8U。
从Oracle的JDK中看,jdk8是LTS版本,第三年出一LTS选择,JDK11是LTS版本,但openjdk中暂时没。据采用的OpenJDK8。
做一次编译的想法,起源于。在品读《深入理解java虚拟机》周志明,大牛的经典书集的一时冲动。
也是对光看不练假把式的一次行动。
A.1获取源码
OpenJDK http://openjdk.java.net/
Source code 1.Mercurial 2.Bundles(6)
复制的下载地址:http://hg.openjdk.java.net/jdk8u/jdk8u/
A.2系统需求
建议尽量在Linux或Solaris上构造OpenJDK,本次采用Ubuntu16.04 LTS。在本文的开头就说明了!
下载源码。打开vmware >ubuntu中输入命令:
首先建议使用root用户来干这个事。
gap@ubuntu:~/jdk8u$ su
密码:
gap@ubuntu:~$ apt install mercurial
[sudo] gap 的密码:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列软件包是自动安装的并且现在不需要了:
libllvm4.0
使用'sudo apt autoremove'来卸载它(它们)。
将会同时安装下列软件:
javascript-common libjs-excanvas mercurial-common
建议安装:
apache2 | lighttpd | httpd qct kdiff3 | kdiff3-qt | kompare | meld | tkcvs
| mgdiff python-mysqldb python-pygments python-openssl
下列【新】软件包将被安装:
javascript-common libjs-excanvas mercurial mercurial-common
升级了 0 个软件包,新安装了 4 个软件包,要卸载 0 个软件包,有 6 个软件包未被升级。
需要下载 1,932 kB 的归档。
解压缩后会消耗 10.2 MB 的额外空间。
您希望继续执行吗? [Y/n] y
获取:1 http://mirrors.yun-idc.com/ubuntu xenial/main amd64 javascript-common all 11 [6,066 B]
获取:2 http://mirrors.yun-idc.com/ubuntu xenial/universe amd64 libjs-excanvas all 0.r3-4 [45.2 kB]
获取:3 http://mirrors.yun-idc.com/ubuntu xenial-updates/universe amd64 mercurial-common all 3.7.3-1ubuntu1.2 [1,833 kB]
获取:4 http://mirrors.yun-idc.com/ubuntu xenial-updates/universe amd64 mercurial amd64 3.7.3-1ubuntu1.2 [47.8 kB]
已下载 1,932 kB,耗时 0秒 (2,041 kB/s)
正在选中未选择的软件包 javascript-common。
(正在读取数据库 ... 系统当前共安装有 219802 个文件和目录。)
正准备解包 .../javascript-common_11_all.deb ...
正在解包 javascript-common (11) ...
正在选中未选择的软件包 libjs-excanvas。
正准备解包 .../libjs-excanvas_0.r3-4_all.deb ...
正在解包 libjs-excanvas (0.r3-4) ...
正在选中未选择的软件包 mercurial-common。
正准备解包 .../mercurial-common_3.7.3-1ubuntu1.2_all.deb ...
正在解包 mercurial-common (3.7.3-1ubuntu1.2) ...
正在选中未选择的软件包 mercurial。
正准备解包 .../mercurial_3.7.3-1ubuntu1.2_amd64.deb ...
正在解包 mercurial (3.7.3-1ubuntu1.2) ...
正在处理用于 man-db (2.7.5-1) 的触发器 ...
正在设置 javascript-common (11) ...
正在设置 libjs-excanvas (0.r3-4) ...
正在设置 mercurial-common (3.7.3-1ubuntu1.2) ...
正在设置 mercurial (3.7.3-1ubuntu1.2) ...#############################............]
Creating config file /etc/mercurial/hgrc.d/hgext.rc with new version#######..............]
gap@ubuntu:~$ hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/
[sudo] gap 的密码:
destination directory: jdk8u
requesting all changes
adding changesets
adding manifests
adding file changes
added 2361 changesets with 2850 changes to 142 files
updating to branch default
86 files updated, 0 files merged, 0 files removed, 0 files unresolved
gap@ubuntu:~$ ll jdk8u/
总用量 408
drwxr-xr-x 7 root root 4096 Jan 16 08:57 ./
drwxr-xr-x 28 gap gap 4096 Jan 16 08:56 ../
-rw-r--r-- 1 root root 1522 Jan 16 08:57 ASSEMBLY_EXCEPTION
drwxr-xr-x 6 root root 4096 Jan 16 08:57 common/
-rw-r--r-- 1 root root 1588 Jan 16 08:57 configure
-rw-r--r-- 1 root root 3107 Jan 16 08:57 get_source.sh
drwxr-xr-x 4 root root 4096 Jan 16 08:57 .hg/
-rw-r--r-- 1 root root 70 Jan 16 08:57 .hgignore
-rw-r--r-- 1 root root 50049 Jan 16 08:57 .hgtags
drwxr-xr-x 2 root root 4096 Jan 16 08:57 .jcheck/
-rw-r--r-- 1 root root 19274 Jan 16 08:57 LICENSE
drwxr-xr-x 6 root root 4096 Jan 16 08:57 make/
-rw-r--r-- 1 root root 6232 Jan 16 08:57 Makefile
-rw-r--r-- 1 root root 1549 Jan 16 08:57 README
-rw-r--r-- 1 root root 129333 Jan 16 08:57 README-builds.html
drwxr-xr-x 3 root root 4096 Jan 16 08:57 test/
-rw-r--r-- 1 root root 153824 Jan 16 08:57 THIRD_PARTY_README
在正式的下载前有必要,看README-builds.html文件。
gap@ubuntu:~/jdk8u$ chmod 755 get_source.sh
root@ubuntu:/home/gap/jdk8u# ./get_source.sh
# Repositories: corba jaxp jaxws langtools jdk hotspot nashorn
corba: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/corba corba
jaxp: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/jaxp jaxp
corba: requesting all changes
jaxp: requesting all changes
corba: adding changesets
jaxp: adding changesets
corba: adding manifests
corba: adding file changes
jaxp: adding manifests
jaxp: adding file changes
corba: added 1870 changesets with 4831 changes to 1392 files
corba: updating to branch default
corba: 1198 files updated, 0 files merged, 0 files removed, 0 files unresolved
jaxws: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/jaxws jaxws
jaxws: requesting all changes
jaxws: adding changesets
jaxws: adding manifests
jaxws: adding file changes
jaxp: added 1955 changesets with 8181 changes to 4242 files
jaxp: updating to branch default
jaxp: 2072 files updated, 0 files merged, 0 files removed, 0 files unresolved
langtools: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/langtools langtools
langtools: requesting all changes
langtools: adding changesets
langtools: adding manifests
jaxws: transaction abort!
jaxws: rollback completed
jaxws: abort: stream ended unexpectedly (got 7032 bytes, expected 21221)
jdk: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/jdk jdk
jdk: requesting all changes
jdk: adding changesets
langtools: adding file changes
jdk: adding manifests
langtools: transaction abort!
langtools: rollback completed
langtools: abort: stream ended unexpectedly (got 15818 bytes, expected 42713)
hotspot: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot hotspot
hotspot: requesting all changes
hotspot: adding changesets
hotspot: adding manifests
hotspot: adding file changes
hotspot: transaction abort!
hotspot: rollback completed
hotspot: abort: stream ended unexpectedly (got 8993 bytes, expected 46086)
nashorn: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/nashorn nashorn
nashorn: requesting all changes
nashorn: adding changesets
nashorn: adding manifests
jdk: adding file changes
nashorn: adding file changes
nashorn: added 2437 changesets with 11585 changes to 2991 files
nashorn: updating to branch default
nashorn: 2772 files updated, 0 files merged, 0 files removed, 0 files unresolved
jdk: added 13428 changesets with 100503 changes to 27823 files
jdk: updating to branch default
jdk: 23326 files updated, 0 files merged, 0 files removed, 0 files unresolved
WARNING: hotspot exited abnormally (255)
WARNING: jaxws exited abnormally (255)
WARNING: langtools exited abnormally (255)
如果写成一篇文章,显的太长太乱,不便于看。把它写成续篇!
至此本篇,主要讲了:1.我的环境,VMWare 中ubuntu 16.04 LTS版本。2.下载的OpenJDK8。3.读了下编译说明文档。
下一篇写。正式的编译工作。