Difference between JVM and HotSpot?

Solution 1:

The definition of what exactly is a Java Virtual Machine is stated in the Java Virtual Machine Specification

The JVM is by definition a virtual machine, i.e. a software machine that simulates what a real machine does. Like a real machine, it has an instruction set, a virtual computer architecture and an execution model. It is capable of running code written with this virtual instruction set, pretty much like a real machine can run machine code.

HotSpot is an implementation of the JVM concept. It was originally developed by Sun, and now it is owned by Oracle. There are other implementations of the JVM specification, like JRockit, IBM J9, among many others.

See List of Java Virtual Machine Implementations

The OpenJDK is a project under which an open source implementation of HotSpot (and many other pieces of the JDK e.g. compiler, APIs, tools, etc) is developed.

Solution 2:

Note: AdoptOpenJDK has changed its name to Adoptium after moving to the Eclipse Foundation in late 2020-06.


Difference between JVM and HotSpot?

A Java Virtual Machine (JVM) is an imaginary computer that has never been physically built as hardware. A JVM runs programs compiled to its imaginary instruction set written to storage as an intermediate representation known as bytecode.

At runtime, the bytecode must be translated from the imaginary instruction set to the actual instruction set of the CPU of the host machine. This can be done on-the-fly by an interpreter. Or the bytecode can be fully compiled and cached, to run faster than through the interpreter, in a process known as Just-In-Time (JIT) compiling.

Over the decades, there have been many implementations of the JVM. Most have fallen away.

HotSpot is one implementation of JIT technology that starts by running interpreted, and watches the actual performance of the app. Parts of the app are then selected to be fully-compiled as native code and cached, for much faster execution. HotSpot was developed at Sun as a commercial product. After acquiring Sun, Oracle further evolved HotSpot by combining important parts of their competing product, JRockit. HotSpot is now open-sourced through the OpenJDK project, available free-of-charge.

Another such implementation in OpenJ9, developed by IBM, and now open-sourced through the Eclipse Foundation and available free-of-charge. Some JVM distributions built on OpenJDK replace HotSpot with OpenJ9 while still using the rest of OpenJDK such as the Java SE class libraries. For example, the pre-built distributions available at AdoptOpenJDK provide your choice of HotSpot or OpenJ9 on some hardware.

Diagram showing history of HotSpot & JRockit merging, and OpenJ9 both available in AdoptOpenJDK.

Diagram showing history of HotSpot & JRockit merging, and OpenJ9 both available in AdoptOpenJDK

What exactly is HotSpot and how does it relate to JVM and OpenJDK? Is it a library? What exactly does it do?

  • HotSpot is an implementation of the part of a JVM that interprets and/or compiles Java bytecode to be executed on the host CPU.
  • OpenJ9 is an alternative.

OpenJ9 is generally known for much faster starting and much lower memory usage initially, while HotSpot may run more efficiently overall for long-running apps. Both are well-regarded, well-worn, and available with distributions of OpenJDK.

OpenJDK is an open-source project that fully implements the Java Specifications, JSRs, and JEPs that define the Java platform. Every JVM implementation I know of today is based entirely or mostly on the OpenJDK codebase and uses either HotSpot or OpenJ9 technology.

Besides the JVM, OpenJDK also provides an implementation in source code for all classes required by the Java SE specifications, such as java.lang, java.util, java.time, and other packages.

Also, what is the difference between OpenJDK and HotSpot?

The source code for HotSpot is housed, maintained, and further developed as part of the OpenJDK project. The alternative, OpenJ9, is housed, maintained, and further developed at the Eclipse Foundation, while replacing HotSpot in some distributions of OpenJDK.

Some distributions of Java technology choose to ship with HotSpot. Some distributions choose to substitute the portion of the OpenJDK codebase that is HotSpot with the alternative, OpenJ9.

Here is a flow chart graphic to help you choose a vendor for a distribution of the Java platform.

Flowchart guiding you in choosing a vendor for a Java 11 implementation

Motivations in choosing a vendor for Java

Solution 3:

OpenJDK (Open Java Development Kit) is a free and open source implementation of the Java Platform, Standard Edition (Java SE).The openjdk is a project started by Sun Microsystems, nowadays care by many companies and the community for build a Java Development Kit absolutely in open source. As per the official documentation.

OpenJDK is an open-source implementation of the Java Platform, Standard Edition (Java SE) specifications. In May 2007, Sun released a fully buildable Java Development Kit (JDK) version for Java SE to the OpenJDK Community as free software under the GNU General Public License version two (GPLv2). Sun announced the Interim Governing Board for the OpenJDK community. Sun also announced that OpenJDK-based implementations can use the Java SE 6 Technical Compatibility Kit (JCK) to establish compatibility with the Java SE 6 specification.

The OpenJDK project consists of a number of components - HotSpot (the virtual machine), the Java Class Library and the javac Java compiler.For more on it, visit its site.

The current JVM provided by Sun/Oracle is called HotSpot because it seeks hot spots of use in the code (places where code is more intensively used) for "just-in-time" optimization. From the wikipedia, HotSpot, released as the "Java HotSpot Performance Engine" is a Java virtual machine for desktops and servers, maintained and distributed by Oracle Corporation.

Solution 4:

HotSpot is, as mentioned above, a cross-platform implementation of the Java Virtual Machine (JVM) Concept, and is distributed with the OpenJDK (Java Developer Kit), under the GNU General Public License. HotSpot is written mainly in C++, and was originally developed under Sun Microsystems. It is currently developed under the OpenJDK Project, at www.java.net. The HotSpot JVM was available as an add-on for Java 1.2, and later was used as the default Sun JVM in Java 1.3. The JVM is currently in Version 7, Build b147, and has an active development community behind it.

For more information, goto: https://www.java.net/

Happy Coding!

Solution 5:

JVM is an abstract machine (specifications). HotSpot, OpenJDK and JRockit and so are implementations of JVM.

Free and open source implementations

  • HotSpot, the primary reference Java VM implementation

  • OpenJDK — Open Java Development Kit is a free and open source implementation licensed under the GNU General Public License (GNU GPL) with a linking exception.

Proprietary implementations

  • JRockit (originally from Appeal Virtual Machines) acquired by Oracle for Linux, Windows and Solaris

for more implementations
link explains differences between HotSpot and JRocket