JVM学习——编译OpenJDK
最近在学习《深入理解java虚拟机 第二版》这本书。书中第一部分建议大家自己编译OpenJDK。抱着学习态度也来编译个玩一玩。下面进入正题。
1.编译环境介绍
| 操作系统 | CentOS Linux release 7.1.1503 (Core) |
| Linux内核版本 | 3.10.0-229.el7.x86_64 |
| gcc版本 | 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) |
| openJdk版本 | openjdk-7u40 |
2.准备工作
2.1下载OpenJDK
| Note that some Linux systems have a habit of pre-populating your environment variables for you, for example JAVA_HOME might get pre-defined for you to refer to the JDK installed on your Linux system. You will need to unset JAVA_HOME. It's a good idea to run env and verify the environment variables you are getting from the default system settings make sense for building the OpenJDK. |
先检查一下本地是否配置有JAVA_HOME
| Bootstrap JDK All OpenJDK builds require access to the previously released JDK 6, this is often called a bootstrap JDK. The JDK 6 binaries can be downloaded from Sun's JDK 6 download site. For build performance reasons is very important that this bootstrap JDK be made available on the local disk of the machine doing the build. You should always set ALT_BOOTDIR to point to the location of the bootstrap JDK installation, this is the directory pathname that contains a bin, lib, and include It's also a good idea to also place its bin directory in the PATH environment variable, although it's not required. |
Certificate Authority File (cacert)See http://en.wikipedia.org/wiki/Certificate_Authority for a better understanding of the Certificate Authority (CA). A certificates file named "cacerts" represents a system-wide keystore with CA certificates. In JDK and JRE binary bundles, the "cacerts" file contains root CA certificates from several public CAs (e.g., VeriSign, Thawte, and Baltimore). The source contain a cacerts file without CA root certificates. Formal JDK builders will need to secure permission from each public CA and include the certificates into their own custom cacerts file. Failure to provide a populated cacerts file will result in verification errors of a certificate chain during runtime. The variable ALT_CACERTS_FILE can be used to override the default location of the cacerts file that will get placed in your build. By default an empty cacerts file is provided and that should be fine for most JDK developers.
|
|
gmake是GNU Make的缩写。
Linux系统环境下的make就是GNU Make,之所以有gmake,是因为在别的平台上,make一般被占用,GNU make只好叫gmake了。
|
java.lang.RuntimeException: time is more than 10 years from present: 1136059200000
at build.tools.generatecurrencydata.GenerateCurrencyData.makeSpecialCaseEntry(GenerateCurrencyData.java:285)
at build.tools.generatecurrencydata.GenerateCurrencyData.buildMainAndSpecialCaseTables(GenerateCurrencyData.java:225)
at build.tools.generatecurrencydata.GenerateCurrencyData.main(GenerateCurrencyData.java:154)
Start 2016-01-10 11:18:43
End 2016-01-10 11:52:15
00:00:15 corba
00:00:21 hotspot
00:00:11 jaxp
00:00:20 jaxws
00:32:15 jdk
00:00:10 langtools
00:33:32 TOTAL
drwxr-xr-x. 2 root root 4096 Jan 9 16:53 fastdebug
drwxr-xr-x. 7 root root 4096 Jan 9 16:56 generated
drwxr-xr-x. 2 root root 4096 Jan 9 16:53 jvmg
drwxr-xr-x. 2 root root 4096 Jan 9 16:53 optimized
drwxr-xr-x. 3 root root 20480 Jan 10 11:19 product
drwxr-xr-x. 2 root root 4096 Jan 9 16:53 profiled
LD_LIBRARY_PATH=.:${JAVA_HOME}/jre/lib/amd64/native_threads:${JAVA_HOME}/jre/lib/amd64:/opt/openJDKroom/openjdk/build/linux-amd64/hotspot/outputdir/linux_amd64_compiler2/product
export LD_LIBRARY_PATH
下面贴出我这个文件的完整内容:
|
# Generated by /opt/openJDKroom/openjdk/hotspot/make/linux/makefiles/buildtree.make # add LD_LIBRARY_PATH=.:${JAVA_HOME}/jre/lib/amd64/native_threads:${JAVA_HOME}/jre/lib/amd64:/opt/openJDKroom/openjdk/build/linux-amd64/hotspot/outputdir/linux_amd64_compiler2/product |
下面执行:
# source ./env.sh
# ./gamma -version
Using java runtime at: /opt/openJDKroom/openjdk/build/linux-amd64/j2sdk-image/jre
openjdk version "1.7.0-internal"
OpenJDK Runtime Environment (build 1.7.0-internal-root_2016_01_10_00_16-b00)
OpenJDK 64-Bit Server VM (build 24.0-b56, mixed mode)
运行成功!!
希望对想要编译openJDK的朋友有个参考。如果有疑问请提出,大家一起学习探讨。>_<
JVM学习——编译OpenJDK的更多相关文章
- 深入理解JVM(一)编译openJDK
此文总结的很不错:https://www.cnblogs.com/ACFLOOD/p/5528035.html 准备openJDK源码和环境 1.在linux和macOS上编译openJDK更加友好, ...
- 走进JVM之一 自己编译openjdk源码
想要深入了解JVM,就必须了解其实现机制.了解JVM实现的最好方法便是自己动手编译JDK.好了,让我们开始吧! 1. 准备工作 获取OpenJDK源码 本次编译选择的是OpenJDK7u,官方源码包 ...
- 源码编译OpenJdk 8,Netbeans调试Java原子类在JVM中的实现(Ubuntu 16.04)
一.前言 前一阵子比较好奇,想看到底层(虚拟机.汇编)怎么实现的java 并发那块. volatile是在汇编里加了lock前缀,因为volatile可以通过查看JIT编译器的汇编代码来看. 但是原子 ...
- JVM学习001通过实例总结Java虚拟机的运行机制
JVM学习(1)——通过实例总结Java虚拟机的运行机制-转载http://www.cnblogs.com/kubixuesheng/p/5199200.html 文章转载自:http://www.c ...
- Linux CentOS 6.9 Minimal 编译 OpenJDK 7
今天学习<深入理解Java虚拟机:JVM高级特性与最佳实践>一书,并动手在Linux系统上编译OpenJDK 7,初次搞不太顺利,特记录下编译操作细节. 一.前期准备 约定:工具默认安装目 ...
- Mac上编译OpenJDK过程记录
编译OpenJDK主要为了学习HotSpot,编译过程在很多相关书籍中都有所涉及,但由于机型.机子具体环境的不同,很难有资料能够一步到位.还是得碰到具体问题通过上网查来一个个解决. 下载OpenJDK ...
- JVM学习笔记(一):JVM初探
1 来源 来源:<Java虚拟机 JVM故障诊断与性能优化>--葛一鸣 章节:第一章 本文是第一章的一些笔记整理. 2 Java里程碑 2.1 Java起源 1990年Sun公司决定开发一 ...
- JVM学习笔记——类加载和字节码技术篇
JVM学习笔记--类加载和字节码技术篇 在本系列内容中我们会对JVM做一个系统的学习,本片将会介绍JVM的类加载和字节码技术部分 我们会分为以下几部分进行介绍: 类文件结构 字节码指令 编译期处理 类 ...
- JVM学习(3)——总结Java内存模型
俗话说,自己写的代码,6个月后也是别人的代码……复习!复习!复习!涉及到的知识点总结如下: 为什么学习Java的内存模式 缓存一致性问题 什么是内存模型 JMM(Java Memory Model)简 ...
随机推荐
- P1311 选择客栈
开始写了一个O(n3)的算法,只得了60,后来思考(找题解),得到了一个O(nk)的算法 其实就是一种预处理的思想,对于每一个客栈而言,只要我们预处理出他前面可以匹配的客栈数量,就可以了. 所以我们记 ...
- vmware centos6.5 net 配置
使用NAT模式 虚拟机网络连接使用NAT模式,物理机网络连接使用Vmnet8. 虚拟机设置里面——网络适配器,网络连接选择NAT模式. 虚拟机菜单栏—编辑—虚拟网络编辑器,选择Vmnet8 NAT模式 ...
- JVM监控和Java应用程序调试
JConsole.VisualVM监控JVM(JMX) JAVA_OPTS后加:-Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.managemen ...
- 周记:Linux下C编程
也啥都没干,计划一个都没干.吼吼-- 周六去看[21天学通Linux_C编程]笔记: 突然都对这本书没信心了.刚开始,就出现的不满如下:1.创建vim启动器时候,类型要选择[终端下的应用程序]没说,虽 ...
- LeetCode Number of Connected Components in an Undirected Graph
原题链接在这里:https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/ 题目: Giv ...
- Class类
package com.imooc.reflect; public class ClassDemo1 { public static void main(String[] args) { //Foo的 ...
- TCP/IP网络编程中socket的行为
一. read/write的语义:为什么会阻塞? 先从write说起: #include <unistd.h>ssize_t write(int fd, const void *buf, ...
- Ubuntu(14.04)远程连接windwos(server2008 r2)
只需安装rdeasktop即可, sudo apt-get install rdesktop rdesktop 192.168.1.100 -g 800x600 其他参数 -f 其实用Ubuntu自带 ...
- ActiveMQ的使用笔记(基本实现原理)
具体原理不进行深入,会用就好. 第一:当然是先安装ActiveMQ,选择操作系统位数,安装成功以后,输入网址http://ip:8161/admin/,会出现相关页面,账号密码都是admin.在这个页 ...
- 【android Studio】零git知识、零脚本命令,即刻体验git版本管理魅力!
git的优点就不去多说了.阻碍咱新手体验它的唯一问题就是门槛太高,脚本看着像天书, 本文主要阐述的,就是如何在android studio上,也能像tfs那样,非常简单的操作,就能使用git进行版本管 ...