Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JDK libraries which are not included in JRE

Tags:

java

I have a trial task which includes writing simple http server using only Oracle JRE 1.6 standard libraries. Here simple HTTP server in Java using only Java SE API I found the statement:

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

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

  1. Is it correct for me to use this implementation?
  2. Why it is stated that JDK has libraries that are not in JRE? Do JDK provide any additional libraries to JRE?
like image 334
Roman Avatar asked May 12 '15 12:05

Roman


1 Answers

Before I answer, please note that I am not familiar with the implementation you're referring to (I generally pull in Jetty and embed it when I need an HTTP server in my modules). So I'll answer somewhat generally, but maybe this gets your mind thinking in a direction that's helpful.

Is it correct for me to use this implementation?

That depends on the constraints on the trial task. Assuming that the implementation meets those constraints, and you are willing to live with any shortcomings it has, then there is nothing intrinsically wrong with using it. If it's available, it's fair game.

Why it is stated that JDK has libraries that are not in JRE? Do JDK provide any additional libraries to JRE?

First off, the statement made in that question is observably false. Clearly that implementation is included in the JRE.

More generally though, the JDK always has the option to do this, and there are definitely libraries deployed with a JDK that are not deployed with a JRE (see this page). Moreover, depending on the install, it's possible that there are installed extensions to the JRE in place (see this page).

like image 178
Trevor Brown Avatar answered Oct 05 '22 01:10

Trevor Brown