0

I want to know whether the official Java core API is part of JDK or JRE.

According to my understanding of Java, I think that the core API should be part of the JRE, as the application should be runnable without the additions provided by the JDK.

I also found some information on the web that says the 3 basic components of the JDK are,

  1. Java Compiler
  2. JVM
  3. Java API


(As the JRE is the implementation of JVM, does the Java API belong to JRE or JDK?)
Edit: actual question: Is the Java API included in JRE?

Alex Salajan
  • 85
  • 1
  • 8
  • Seems like it's a part of the [JRE](https://www.javatpoint.com/difference-between-jdk-jre-and-jvm) – Austin Schaefer Jun 18 '19 at 12:17
  • 3
    JDK = JRE + development tools. – Holger Jun 18 '19 at 12:18
  • Mostly dupe https://stackoverflow.com/questions/1906445/what-is-the-difference-between-jdk-and-jre and https://stackoverflow.com/questions/11547458/what-is-the-difference-between-jvm-jdk-jre-openjdk and more. Since java 9 what used to be simply the 'SE' (Standard Edition) library [is described as the 'core' platform and divided into several modules](https://docs.oracle.com/javase/9/docs/api/overview-summary.html) – dave_thompson_085 Jun 18 '19 at 12:25
  • @dave_thompson_085 on those 2 questions the location of the Java core API is nowhere explicitly specified. But @ Stephen C did provide below an answer for that. – Alex Salajan Jun 18 '19 at 15:05
  • @Holger thanks for the comment, but that was not the question being asked :) – Alex Salajan Jun 18 '19 at 15:10
  • @AlexSalajan it’s the crucial point that renders your question obsolete. – Holger Jun 18 '19 at 16:34

2 Answers2

6

Your facts are a bit inaccurate.

I also found some information on the web that says the 3 basic components of the JDK are: 1. Java Compiler, 2. JVM, 3. Java API.

That's not a good summary. There are certainly other things in a JDK apart from that.

As the JRE is the implementation of JVM

In fact the JRE includes an implementation of the JVM. And it also includes the core Java APIs, and a few other things.

As Holger points out, a JDK consists of a JRE plus some additional Java development tools. Or as he succinctly puts it:

"JDK = JRE + development tools"


So to answer your question:

does the Java API belong to JRE or JDK?

The Java APIs are included in both a JRE distribution or JDK distribution, but the phrase "belong to" doesn't have much meaning in this context.


(Now one could debate whether a JDK "contains" a JRE (or not), and whether the JRE "contains" the Java APIs. But to be honest it is a pointless debate. What really matters is that the Java APIs are present in both kinds of distribution.

Also, this is substantially moot in Java 11, since Oracle no longer provides JRE distributions for either Oracle or OpenJDK Java. It is now JDK only.)

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • thanks for the good answer. Maybe my wording was a bit off, but you got the idea. I know there are more than those 3 components in the JDK, but that statement confused me regarding the location of the java Core API. And of course, if the API is included in JRE it will also be included in the JDK. Yes, the right question would have been whether the API is included in the JRE or not. – Alex Salajan Jun 18 '19 at 15:21
2

A picture is worth a thousand words.

Java Conceptual Diagram

However, please note, the above diagram reflects the structure of JDK 8 and for later editions it is different.

Yevgen
  • 1,576
  • 1
  • 15
  • 17