zoukankan      html  css  js  c++  java
  • ubuntu 编译 jdk (一)

    ubuntu 编译 jdk,本文的写作时间是2019.1.14。

    这次一次完整的全过程编译讲解,请耐心读完本连篇文章,或许对你的编译有帮助 !

    我的编译环境:

    系统:在VMWare中、Ubuntu 16.04 LTS 版本。

    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/

    这里要补充一句,OpenJDK是采用的Mercurial进行的版本管理,当然下载也是需要用Mercurial下载。

    操作如下: 

     

     

    A.2系统需求

    建议尽量在Linux或Solaris上构造OpenJDK,本次采用Ubuntu16.04 LTS。

    下载源码。打开vmware >ubuntu中输入命令:

    首先建议使用root用户操作,基于权限问题的一些不必要的报错。

    gap@ubuntu:~/jdk8u$ su
    密码: 
    

    其次,安装mercurial版本管理软件。

    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#######..............] 
    

    其次,正式下载jdk8u源代码。可能需要一段时间,视你的网络速度而定!

    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
    

    其次,查看下载的jdk8u文件夹。

    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   !!!

    虽然是英语,如果看着吃力,可以用google插件翻译,对比阅读。强调一定要通读一遍  !!!

    重要点,图中框出!

    下载源码的脚本命令  !!!

    A3,下载源码

    首先,进入jdk8u文件夹,修改  get_source.sh  的权限。

    gap@ubuntu:~/$ cd  jdk8u
    gap@ubuntu:~/jdk8u$ chmod 755 get_source.sh 
    

    其次,执行  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.通读了,jdk8u编译的说明文档。

    下一篇写。正式的编译工作。

     

    扫码关注微信,不定期用心推送优质文章。

     

     

  • 相关阅读:
    XE8下安装IntraWeb 14.0.40和D7下安装IntraWeb 11.0.63破解版的正确方法
    网易博客打不开怎么办
    SQL SERVER 导入EXCEL的存储过程
    TMemoryStream、String与OleVariant互转
    【转载】Delphi Idhttp的get和post方法
    sqlserver得到行号
    Delphi 中的 XMLDocument 类详解(5)
    10款免费且开源的项目管理工具
    iOS开发者必备:九大设计类工具
    15个步骤创立技术公司,并收获千万用户(完结)
  • 原文地址:https://www.cnblogs.com/ncepu/p/13694926.html
Copyright © 2011-2022 走看看