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 conflictsidlj – 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 bytecodejavadoc – the documentation generator, which automatically generates documentation from source code commentsjar – 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 applicationsjarsigner – the jar signing and verification tooljavah – the C header and stub generator, used to write native methodsjavap – the class file disassemblerjavaws – the Java Web Start launcher for JNLP applicationsJConsole – Java Monitoring and Management Consolejdb – the debuggerjhat – 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 Controljps – 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 keystorepack200 – JAR compression toolpolicytool – 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 capabilitieswsimport – 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、HotSpot And OpenJDK And OracleJDK And JER区别的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: js判断浏览器是否为IE
- 下一篇: 李宏毅-机器学习-RNN-笔记