1、HotSpot And OpenJDK And OracleJDK And JER区别

学习java前我们先了解下这几个词的区别,HotSpot、JDK、JRE、OpenJDK、Oracle JDK

一、HotSpot

运营是运行字节码的虚拟机平台。HotSpot是JVM(Java Virtual Machine),是一个运行Java字节码的虚拟机,具有语言无关性和平台无关性。平台无关性:我们java编写的程序可以运行在window、mac、Linux上就是HotSpot的平台无关性。 语言无关性:比如Java、kotlin、Scala、Clojure、Groovy、Jython、JRuby、Ceylon、Eta、Haxe、net等语言可以运行JVM上。 目前JVM的平台无关性让java长期成为编程语言的TOP1,后续语言无关性是否也能让java更上一层楼也说不准。

1、HotSpot包括

Java ClassLoader、Java字节码解释器、Client和Server模式的虚拟机针对不同用途做优化、垃圾回收器、一组运行时库。为什么叫HotSpot?因为这款虚拟机当时就是为了性能而打造,会分析程序执行的热点(hotspots),将这些热点即时编译以优化性能,固取名HotSpot。

2、HotSpot现状

 实现语言:C++ 

 代码规模:2007年Sun估算了下HotSpot大约有250,000行代码。

 许可证:2006年11月13日,HotSpot JVM和JDK开始使用GPLV2许可证,随后加入到了Java 7中。

二、JDK

JDK是开发工具集合。JDK(Java Development Kit),Java开发工具集,是Java SE、Java EE、Java ME的一种实现(为毛Java要搞这么多平台),以二进制应用形式发布,包含一个JVM和「其他开发Java应用程序所需的东西」,jdb包含组件如下。

appletviewer – this tool can be used to run and debug Java applets without a web browser apt – the annotation-processing tool[4]

extcheck – a utility that detects JAR file conflicts

idlj – the IDL-to-Java compiler. This utility generates Java bindings from a given Java IDL file.

jabswitch – the Java Access Bridge. Exposes assistive technologies on Microsoft Windows systems.

java – the loader for Java applications. This tool is an interpreter and can interpret the class files generated by the javac compiler. Now a single launcher is used for both development and deployment. The old deployment launcher, jre, no longer comes with Sun JDK, and instead it has been replaced by this new java loader.

javac – the Java compiler, which converts source code into Java bytecode

javadoc – the documentation generator, which automatically generates documentation from source code comments

jar – the archiver, which packages related class libraries into a single JAR file. This tool also helps manage JAR files.

javafxpackager – tool to package and sign JavaFX applications

jarsigner – the jar signing and verification tool

javah – the C header and stub generator, used to write native methods

javap – the class file disassembler

javaws – the Java Web Start launcher for JNLP applications

JConsole – Java Monitoring and Management Console

jdb – the debugger

jhat – Java Heap Analysis Tool (experimental)

jinfo – This utility gets configuration information from a running Java process or crash dump. (experimental)

jmap Oracle jmap - Memory Map– This utility outputs the memory map for Java and can print shared object memory maps or heap memory details of a given process or core dump. (experimental)

jmc – Java Mission Control

jps – Java Virtual Machine Process Status Tool lists the instrumented HotSpot Java Virtual Machines (JVMs) on the target system. (experimental)

jrunscript – Java command-line script shell.

jstack – utility that prints Java stack traces of Java threads (experimental)

jstat – Java Virtual Machine statistics monitoring tool (experimental)

jstatd – jstat daemon (experimental)

keytool – tool for manipulating the keystore

pack200 – JAR compression tool

policytool – the policy creation and management tool, which can determine policy for a Java runtime, specifying which permissions are available for code from various sources.

VisualVM – visual tool integrating several command-line JDK tools and lightweight[clarification needed] performance and memory profiling capabilities

wsimport – generates portable JAX-WS artifacts for invoking a web service.

xjc – Part of the Java API for XML Binding (JAXB) API. It accepts an XML schema and generates Java classes.

为什么Java搞这么多平台呢?估计是不同场景下的开发所需的API大不相同,全整合到一起又嫌大,所以分不同场景搞了多个平台吧。

三、OpenJDK

开源版本JDK。 Open Java Development Kit是Java SE的开源免费实现。Sun公司在JavaOne 2006会议上宣布将开源Java,随后在2006年11月13日Sun以GPL许可发布了HotSpot以及编译器,并承诺JDK剩余的部分将会在2007年5月以GPL发布,"除开一些Sun无权以GPL许可发布源码的组件之外"。2007年5月8日,Sun以GPL许可发布了Java类库的源码,除开一些第三方授权给Sun的受限的部分,如Java图形用户接口等。Sun决定接下来要替换掉这些受到专利保护的部分,从而使Java类库完全免费。2007年5月,OpenJDK类库有4%的部分有专利保护。2008年5月发布的OpenJDK 6,只剩下不到1%的部分(SNMP的实现,非Java规范的部分)。到2009年4月OpenJDK 7发布时,所有专利保护部分终于全部去除。

四、OracleJDK

商业版本JDK。Oracle JDK采用了商业实现,而OpenJDK使用的是开源的FreeType。当然,“相同”是建立在两者共有的组件基础上的,Oracle JDK中还会存在一些Open JDK没有的、商用闭源的功能,例如从JRockit移植改造而来的Java Flight Recorder。预计以后JRockit的MissionControl移植到HotSpot之后,也会以Oracle JDK专有、闭源的形式提供。Oracle的项目发布经理Joe Darcy在OSCON 2011上对两者关系的介绍也证实了OpenJDK 7和Oracle JDK 7在程序上是非常接近的,两者共用了大量相同的代码(如下图,注意图中提示了两者共同代码的占比要远高于图形上看到的比例),所以我们编译的OpenJDK,基本上可以认为性能、功能和执行逻辑上都和官方的Oracle JDK是一致的。OpenJDK是OracleJDK的子集合,他们授权的方式不同。

五、JRE

Java运行时环境,顾名思义就是指运行java程序所需要的环境,那么运行Java程序的最小集合就是JRE了,显然包含一个JVM,再加上一些Java类库就可以了,其他东西都不需要。在这个基础上再加上一些编译调试工具啥的(比如javac, jstack工具)就是上面说的JDK了。所以如果你只是要运行Java程序,有JRE就可以了,但如果要开发Java程序,就得有JDK。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值