Are OpenJDK VM and Oracle Hotspot VM still two different JVMs?
I can't seem to find any somewhat official documentation on anything about OpenJDK VM. Even in OpenJDK homepage there is an HotSpot Group which develops HotSpot VM.
The HotSpot group is comprised of developers involved in the design, implementation, and maintanence of the HotSpot virtual machine
However if I check java -version on my Windows machine it prints out
Java HotSpot(TM) 64-Bit Server VM
But on my Ubuntu VPS
OpenJDK 64-Bit Server VM
If those are two different VMs what are the main differences between them? Do they have different runtime flag sets?
tl;dr
The accepted Answer by apangin is now outdated.
For recent versions such as Java 11, the Oracle JDK product is virtually identical to the OpenJDK project. OpenJDK now includes Oracle's previous offerings: Java Flight Recorder, Java Mission Control, Application Class-Data Sharing, and ZGC.
To quote the Oracle.com blog:
From Java 11 forward, therefore, Oracle JDK builds and OpenJDK builds will be essentially identical.
Oracle JDK & OpenJDK converging
Oracle has made dramatic changes in the last couple years.
Oracle declared their intention to converge their branded Oracle JDK with OpenJDK to feature-parity. Both are based on the OpenJDK code base.
Towards that end, the formerly commercial tools sold by Oracle, Flight Recorder and Mission Control are now open-sourced and donated to the OpenJDK project. See this and this on the OpenJDK site.
Oracle and other members of the OpenJDK consortium have contributed yet more source code to make the OpenJDK code base entirely open-source and unencumbered by licenses other than the GNU GPL+linking exception.
Oracle has changed their licensing terms. The Oracle JDK branded product is no longer free-of-cost for use in production. Alternatively, you can get a free-of-cost distribution of OpenJDK from any of over half a dozen vendors, including one from Oracle. For all the details, see this vital white paper written by pillars of the Java community, Java Is Still Free.
I drew this flowchart to guide you in selecting a JDK source.
Oracle reserves the right to patch their own branded product for an urgent fix or security vulnerability. But the company has stated their intention to also contribute and coordinate with the other OpenJDK members. Oracle continues to own the Java trademarks and to lead the future of the Java platform. For the existing Long-Term Support (LTS) versions 8 and 11, Oracle has ceded stewardship to RedHat (IBM).
HotSpot versus OpenJ9
The Question here asks:
Are OpenJDK VM and Oracle Hotspot VM still two different JVMs?
As discussed above, the two products are converging at feature parity. Regarding HotSpot technology, read on.
HotSpot is one component within both Oracle JDK and OpenJDK, as discussed above. Today’s HotSpot also combines parts from JRockit. Oracle merged the best of both Java engines, having acquired them from Sun Microsystems and BEA Systems.
The Adoptium project (formerly known as AdoptOpenJDK) from the Eclipse Foundation also provides a build of OpenJDK using Eclipse OpenJ9 (based on J9, donated by IBM) as an alternative to HotSpot. When downloading from Adoptium web site, you choose either HotSpot or OpenJ9 from a menu.
Currently, tests seem to show OpenJ9 as dramatically faster to launch while using much less memory, but HotSpot may run faster with sustained usage. But this is still early days for OpenJ9, so investigate for yourself the latest developments.
Oracle HotSpot JVM is based on OpenJDK HotSpot project. So, they are mostly the same VM, except that Oracle JVM has a few additional commercial features, mainly, Java Flight Recorder, Application Class Data Sharing and Cooperative Memory Management.
Runtime flags are almost the same for both VMs; see the complete list using
-XX:+UnlockDiagnosticVMOptions -XX:+UnlockCommercialFeatures -XX:+PrintFlagsFinal
As of JDK 8u131, the only difference is in the following flags (absent in OpenJDK VM):
bool EnableResourceManagementTLABCache = true {product}
bool EnableSharedLookupCache = true {product}
bool FlightRecorder = false {commercial}
ccstr FlightRecorderOptions = {product}
bool LogCommercialFeatures = false {product}
ccstr MemoryRestriction = none {commercial}
bool ResourceManagement = false {commercial}
intx ResourceManagementSampleInterval = -1 {commercial}
ccstr StartFlightRecording = {commercial}
bool TraceSharedLookupCache = false {product}
bool UnlockCommercialFeatures := true {commercial}
bool UseAppCDS = false {commercial}
Related
App A, ran from IntelliJ, has CPU usage and I can look at threads. App B has no Threads tab and CPU usage shows "Not supported for this JVM". Both apps are ran with same JVM. Why / what happened?
JVM: Java HotSpot(TM) 64-Bit Server VM (25.101-b13, mixed mode)
Java: version 1.8.0_101, vendor Oracle Corporation
Java Home: /usr/lib/jvm/java-8-oracle/jre
I can take a thread dump with jstack.
Apps are simple command-line programs, not larger than 10 classes. One app uses finalization, if it matters.
I started both apps from IntelliJ Idea, via Run. App A when started from CLI (via java FinalizerTest) and looked at with jvisualvm had Threads and CPU usage, despite not having it previously. This is still the same JVM that runs it, so I guess this is Intellij problem?
If I can provide more information, freely ask.
I read a few posts about JVM at Stack Overflow and would like to download a binary copy of the Hotspot JVM, yet I am not able to find it on http://www.java.net.
Beside that, what is the difference between Hotspot JVM and JVMs found at Oracle
Is Oracle JVM good for a production website?
Overview:
This SO question may clear up your questions regarding "What is JVM, Hotspot and OpenJDK".
Basically:
JVM means Java Virtual Machine. The JVM is the underlying runtime that executes java bytecode. There are multiple different implementations out there, all implementing the Java Virtual Machine Specification
HotSpot is the most used implementation of the JVM concept. It is used in both, Oracle JDK and OpenJDK. Oracle's JDK can be downloaded on oracle's website, currently http://www.oracle.com/technetwork/java/javase/downloads/index.html. This is "the typical JVM you will find on a normal user's windows machine".
OpenJDK is the open source project maintaining and impelmenting the HotSpot JVM, but also many other projects beside the JVM such as Graal or VisualVM. On Ubuntu for example you can install this OpenJDK (current version 8) by running sudo apt-get install openjdk8.
Conclusion:
While this explaination is not really perfect, it may be good enough to understand that there is no big difference between Oracle JDK and OpenJDK. If you are interested in a little more info on this, have a look at the SO question Differences between Oracle JDK and Open JDK
JDK / JVM sourcecode:
If you are interested in the source code, OpenJDK is the way to go. Here you can find the current OpenJDK 8 (which includes the HotSpot JVM). Its source code can be found here. It also states how to download the source code:
The jdk8u-dev forest for ongoing development can be cloned using this command: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u-dev;cd jdk8u-dev;sh get_source.sh .
The corresponding master forest jdk8u can be cloned using this command: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u;cd jdk8u;sh get_source.sh .
In addition, the source code for the last release, 8u66, is available by cloning the 8u master forest : http://hg.openjdk.java.net/jdk8u/jdk8u and using the 'jdk8u66-b17' mercurial tag.
OpenJDK currently does not have support for a JRE on MIPS processors (there's a port in progress, but who knows how long that will take).
I'm trying to understand how the JRE works, and what is standing in the way of using OpenJDK on our embedded system running Linux on a MIPS processor. If I have a custom JVM that is capable of running on MIPS designed to work with OpenJDK (in this case, I'm referring to JamVM 2.0), is there anything else preventing the JRE from running on the MIPS board? Are any other parts of the JRE platform-dependent?
My understanding is that the JRE is (mostly) composed of two units: the virtual machine, which abstracts the hardware and which is platform-dependent, and the collection of Java libraries which run on the virtual machine and which are not platform-dependent.
To be clear, my questions is: aside from the JVM, is any part of the Java Runtime Environment platform-dependent?
"aside from the JVM, is any part of the Java Runtime Environment platform-dependent?"
That depends on where you place the boundary where the VM ends and the JRE begins. I would consider memory management and code execution as 'the VM', everything more specific part of the JRE.
Thats means every binding to the operating system, be it I/O, Graphics etc. is part of the JRE. Thus the JRE has many platform dependent parts; you usually just don't notice them because your code uses their abstractions (e.g. File, Socket, Window).
So when you say "a port to MIPS" it doesn't mean anything without specifying an OS (ok, your link says Linux); a VM ported to a processor architecture by itself does not make a working java environment. It also requires a port of the native parts of the JRE that allow the java program to actually communicate with things outside the VM; thats where the OS platform comes in.
Since Linux is already supported for x64, the MIPS port should be able to reuse most of the JRE to platform bindings from that.
I understand that the Oracle Java SE contains closed source extensions and tools that are not part of the OpenJDK however is the Oracle Java SE JVM identical to the OpenJDK JVM or does Oracle make changes to the OpenJDK JVM before releasing it as a Java SE JVM?
Update 1:
I found some info from the JDK7 updates projects: http://openjdk.java.net/projects/jdk7u/qanda.html
Will the 7 Update Project receive security fixes from Oracle?
Yes.
As with OpenJDK 6, security fixes are first kept confidential and applied to a private forest before being pushed to the public forest as part of the general synchronized publication of the fix to effected JDK release trains. In addition, they will not go through the public code review and putback approval process, and their corresponding issues in the Project's issue tracker will not be publicly visible.
OpenJDK is the reference implementation of Java as of version 7.
OpenJDK 7 is the starting point for the version that Oracle distributes as Oracle JDK. Other vendors (e.g. RedHat for IcedTea) may also use OpenJDK as their starting point.
In terms of the differences between OpenJDK and a vendor VM, there may be patches which a vendor wants to apply but which the overall OpenJDK community has not accepted into mainline.
Vendor VMs must, of course, be able to prove that they are in conformance with the TCK if they want to use the Java trademarks to describe their product.
Oracle JDK is also not open-source. This is possible because of Java's dual licensing arrangements, and the fact that Oracle own Java overall.
Do you have more specific questions - as posed, your question is a bit vague. What specific aspects are you interested in?
As i know java programs are able to run on any Operating System.
and there are JVM's for any kind of machines.
I need a JVM that runs on my PC stand alone, and not on my OS (windows or any thing else).
I mean a JVM that acts like a boot, instead of the OS boot
i searched for all versions of JVM on "www.java.com/en/download/manual.jsp", but i did not get the suitable JVM.
the following link helped me a little but that was not enough
http://java-virtual-machine.net/other.html#jvm
my PC CPU is AMD Athlon(tm) 64X2 Dual Core Processor 5200 + 2.69 GHz
any body can help me to find the suitable jvm version ?!
Sure, have a look at JRockit Virtual Edition. As I understand it it's basically a micro kernel especially tailored for the JRockit VM.
From this page:
Java without the OS: JRockit Virtual Edition (VE)
Am I the only one that's never heard of this before? The Oracle JRockit team is looking at eliminating the OS from the stack required to run Java. This product will be called JRockit VE (not out yet)
JavaOS
Good lucking getting hold of it, though, it's nothing more than a historical curiosity.
There are two JVMs that I am aware of, which have this property:
The Fiji WM: http://www.fiji-systems.com/index.html
According to http://rtjava.blogspot.com/2009/11/new-real-time-vm-was-born-fiji-vm.html it also runs on bare metal.
The next possibility is JNode: an open source operating system where most parts are written in Java (the rest in assembly): http://www.jnode.org/
JNode is still beta, though.
No.
There was an idea of making a machine that could run a JVM as an actual machine (non virtualized), similiar to LISP machines, but that idea never took off...
You need a host OS to run a JVM.
Googling "java real machine" might give you some interesting articles.
I've found two: one from 2004, talking about how such a machine could be built and another one, talking about how JVM runs as a real machine on hardware such as mobile devices.
Still, no dice with a plain PC.