JDK libraries that are not included in the JRE

I have a trial task that involves creating a simple HTTP server using only the standard Oracle JRE 1.6 libraries. Here's a simple HTTP server in Java using only the Java SE API. I found an expression:

Since Java 1.6, there a builtin HTTP server in Sun Oracle JDK (note: JDK, not JRE).

But I thought that all runtime libraries are included in the JRE, and the JDK is JRE + some development tools. In addition, I downloaded JRE 1.6 and found that the HttpServer is included in the rt.jar file. So my questions are:

  • Am I right to use this implementation?
  • Why is it indicated that the JDK has libraries that are not in the JRE? Does the JDK provide additional JRE libraries?
+6
source share
1 answer

Before answering, please note that I am not familiar with the implementation you are talking about (I generally retract Jetty and insert it when I need an HTTP server in my modules). Therefore, I will answer as a whole, but perhaps it makes your mind think in a direction convenient for you.

Am I right to use this implementation?

It depends on the limitations of the trial task. Assuming that the implementation complies with these limitations, and you are ready to live with any flaws that it has, then there is nothing really wrong with its use. If available, this is fair play.

Why is it indicated that the JDK has libraries that are not in the JRE? Does the JDK provide additional JRE libraries?

Firstly, the statement made in this matter is false. Obviously, the implementation included in the JRE.

In general, the JDK always has the ability to do this, and specifically libraries are deployed with JDKs that are not deployed with JREs ( see this page ). In addition, depending on the installation, it is possible that the installed JRE extensions are installed ( see this page ).

+1
source

Source: https://habr.com/ru/post/987049/


All Articles