JDK、JRE、JVM以及openJDK


一、Java概念

1.1 Java的歷史

Java(一種咖啡名)是太陽微系統(Sun Microsystems)公司於1995年開始開發的。
在印度尼西亞,有一個島嶼叫做爪哇島,英文名叫java,因盛產咖啡而聞名。
而java的開發工程師們非常喜歡喝這種咖啡,所以將語言命名為java,以及將圖標設置為一杯咖啡。

第一個版本於1996年1月23日發布,叫做為Oak。而真正第一個穩定的版本JDK 1.0.2,被稱作Java 1

公司 Java版本 代號 年份 備注
Sum Microsystems Beta 1995年 開始開發
JDK1.0 1996年
JDK1.1 1997年
J2SE1.2 Playground 1998年12月 發布三天后版本變為2,Java2有4個銷售版本,J2SE/J2EE/J2ME/Java Card
J2SE1.3 Kestrel 2000年 J2SE 1.3
J2SE1.4 Merlin 2002年 J2SE 1.4,此版本及以后是一套規范,軟件本身成為參考實現
Java 5 Tiger 2004年 Java 5
2006年11月13日 Sum公司將Java開源
Java SE 6 Mustang 2006年12月
2009年
Oracle Java SE 7 Dolphin 2011年7月
Java SE 8(LTS) 2014年3月 2030 年 12 月結束支持

wikipedia中Java歷史版本表:

1.2 JDK、JRE、openJDK的區別

JRE(Java Runtime Environment) 是運行Java程序所必須的環境,包括JVM和一些核心類庫,用於運行字節碼。
JDK(Java Development Kit) 是開發Java程序所必須的環境,包括JRE和一些編譯工具比如javac.exe
openJDK是JDK的開源,有很多種實現,可以自由選擇。

Oracle對openjdk的實現有兩個版本,
一個是商業版的Java SE Development Kit 點我跳轉到下載界面
一個是開源的openjdk 點我跳轉到下載界面

還有一些其他的知名openjdk實現,
比如Adopt openjdk 點我跳轉到下載界面

還有Liberica jdk 點我跳轉到下載界面

1.3 java.exe、javaw.exe、jvm.dll的區別

JVM: Java Virtual Machine.

引用stackoverflow上的一段解釋:

項目 描述
jvm.dll is the actual Windows implementation of the JVM (or better, the main entry point). C or C++ applications can use this DLL to run an embedded Java runtime, and that would allow the application to interface directly with the JVM, e.g. if they want to use Java for its GUI.
java.exe is a wrapper around the DLL so that people can actually run Java classes without the need for a custom launcher application. It is a Win32 Console application, so Windows will open a fresh Command Prompt window if the exe is not run from a batch file.
javaw.exe is a wrapper like java.exe, but it is a Win32 GUI application. Windows doesn't have to open a Command Prompt window, which is exactly what you want to run a GUI application which opens its own windows.

另一段解釋:

項目 描述
java.exe run a Java program (need to specify classes and/or JARs) starting from specified class containing main() method.
javaw.exe as above but does not create a Windows command prompt (suitable for Swing programs that do not need a console).
jvm.dll this is not a runnable but a library. Probably used by both programs above.

綜上所述,java.dll是jvm在windows上的實現,而java.exejavaw.exe是對這個鏈接庫的包裝/調用,java.exe用於命令行程序因為它會打開一個命令行界面,而javaw.exe則用於gui界面。

一些工具介紹 These tools are the foundation of the JDK. They are the tools you use to create and build applications.

Tool Name Brief Description Links to Reference Pages
javac The compiler for the Java programming language.
java The launcher for Java applications. In this release, a single launcher is used both for development and deployment.
The old deployment launcher, jre, is no longer provided.
javadoc API documentation generator.
See Javadoc Tool page for doclet and taglet APIs.
apt Annotation processing tool.
See Annotation Processing Tool for program annotation processing.
appletviewer Run and debug applets without a web browser.
jar Create and manage Java Archive (JAR) files.
See Java Archive Files page for the JAR specification.
jdb The Java Debugger.
See JPDA for the debugger architecture specifications.
javah C header and stub generator. Used to write native methods.
javap Class file disassembler
extcheck Utility to detect Jar conflicts.

我該怎么選Java版本?

參考stackoverflow上的一個問題:what-is-the-reason-to-use-openjdk


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM