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 点我跳转到下载界面
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.exe
和javaw.exe
是对这个链接库的包装/调用,java.exe用于命令行程序因为它会打开一个命令行界面,而javaw.exe则用于gui界面。
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
有了计划记得推动,不要原地踏步。