14

I was going through server jre, when i extracted serverjre tar.gz , it gave me jdk folder. why does serverJRE gives JDK like folder. There is JRE folder inside serverJRE also. So which one to use, whole serverJRE or just JRE folder which is inside serverJRE. Also contents of JRE inside serverJRE is same as JRE inside JDK.

I am not understanding the difference.

Kaustubh_Kharche
  • 725
  • 3
  • 13
  • 34
  • 1
    You mentioned java 6 and java 8 in the tags. Which are you talking about? And which tar.gz file are you talking about? What is the full file name of the file you downloaded? – Stephen C Oct 29 '15 at 07:47
  • there was no tag stating jdk1.8 so i used java 8. btw here i m not bithered about versoin of java. my question is different. – Kaustubh_Kharche Oct 29 '15 at 07:50
  • 3
    @Tunaki may I suggest adding https://stackoverflow.com/questions/21057365/oracles-server-jre-contains-jdk as a second duplicate? The current duplicate explains the differences between the two, but not the folder structure OP asks about. – user247702 Jul 05 '17 at 08:45
  • 2
    I disagree with the first duplicate answer. This question is about the difference between installing the "Server JRE" and the "JRE", and not about running java -server. @Stijn suggested a closer answer, but the question is asked from a different angle. – jla Mar 28 '18 at 21:11
  • 1
    Oracle is pointing from their Downloads pages to this blog post to clarify why Server JRE: https://blogs.oracle.com/java-platform-group/understanding-the-server-jre . If I could add an answer I'd summarize their in-depth posting. – jla Mar 28 '18 at 21:25

3 Answers3

16

Server JRE: It is used to deploy long-running java applications on server. It provides the fastest possible operating speed. It has been specifically fine tuned to maximize peak operating speed. It has highly aggressive algorithms to optimize the runtime performance of java application. It also includes variety of monitoring tools.

Client JRE: It is used to run java applications on the end-users systems. It contains everything to run the java applications. It can start up faster and requires a smaller memory footprint.

Kevin Andrid
  • 1,963
  • 1
  • 15
  • 26
  • agreed...but why does serverJRE comes as JDK. when i extracted "serverjre.tar.gz" it gave me folder named " jdk". – Kaustubh_Kharche Oct 29 '15 at 06:46
  • I think the serverJRE files are installing in JDK directory,that's why your folder named ".jdk". Just check your installing directory. – Kevin Andrid Oct 29 '15 at 07:06
  • 2
    Many times servers get web-apps installed, containing JSP, or similar that need the JDK to get compiled. – Verhagen Oct 29 '15 at 07:09
  • kelvin, m not talking about installation n all. i just extra extracted the serverjre.tar.gz n on extraction it gave me folder with name jdk. which has exactly same hierarchy as that of simple jdk – Kaustubh_Kharche Oct 29 '15 at 07:16
2

From Oracle's page.

The Server JRE includes tools for JVM monitoring and tools commonly required for server applications, but does not include browser integration (the Java plug-in).

So the difference is incredibly small. This would also mean that the difference between Server JRE and the JDK seems to be mainly that the JDK has a compiler. I didn't even realize that they have made the JREs into separate products, but over the years I can't remember anyone ever suggesting the Client JRE to anyone.

Considering that Applets are all but dead, I don't see any good reason to download the Client JRE. Then again I'm not in the business for desktop Java, so who knows.

Kayaman
  • 72,141
  • 5
  • 83
  • 121
  • so kayaman, would you use whole serverJRE or just JRE folder inside serverJRE. coz both does the job. – Kaustubh_Kharche Oct 29 '15 at 07:18
  • 1
    I generally have the JDK on the servers, since I want all the possible tools to be available in case something goes wrong and I need to wake up in the night to fix it. – Kayaman Oct 29 '15 at 07:23
  • 2
    I always recommend installing JDKs because that way, users don’t risk getting crapware (Ask Toolbar, etc.) installed. That should be reason enough. Besides that, for 64 Bit, there is no client JVM anyway, so there are no technical differences under the hood… – Holger Oct 29 '15 at 10:45
0

I don't think people understood where the OP was coming from and I just ran into this. What follows is some detailed context.

As of the latest quarterly updates the root level directory inside the server jre gzipped tar ball inside of "p22187044_17095_Linux-x86-64.zip" is "jdk1.7.0_95"

IMO, this is sloppy on Oracle's part. In the case where you need to work with both and attempt to extract each in the same directory, you will be extracting both into the same directory.

$ unzip p22187044_17095_Linux-x86-64.zip server-jre-7u95-linux-x64.tar.gz
$ tar xzvf server-jre-7u95-linux-x64.tar.gz
# Extracted files with top-level directory: "jdk1.7.0_95"
# This polluted my previously extracted JDK (See differences below).

# Get a clean JDK 7 again:
$ rm -rf jdk1.7.0_95/

$ tar xzvf jdk-7u95-linux-x64.tar.gz

# Try again with the JRE; this time creating a container directory for the tar extraction:
$ mkdir jre1.7.0_95   &&   tar  xzvf server-jre-7u95-linux-x64.tar.gz -C jre1.7.0_95/
# Directory "jre1.7.0_95/" contains top-level directory "jdk1.7.0_95"

# Let's look at the differences:
$ diff -qr  jdk1.7.0_95     jre1.7.0_95/jdk1.7.0_95/

Only in jdk1.7.0_95/bin: ControlPanel
Only in jdk1.7.0_95/bin: javaws
Only in jdk1.7.0_95/bin: jcontrol
Only in jdk1.7.0_95/bin: jmc
Only in jdk1.7.0_95/bin: jmc.ini
Only in jdk1.7.0_95/jre/bin: ControlPanel
Only in jdk1.7.0_95/jre/bin: java_vm
Only in jdk1.7.0_95/jre/bin: javaws
Only in jdk1.7.0_95/jre/bin: jcontrol
Only in jdk1.7.0_95/jre/lib/amd64: libdeploy.so
Only in jdk1.7.0_95/jre/lib/amd64: libjavaplugin_jni.so
Only in jdk1.7.0_95/jre/lib/amd64: libnpjp2.so
Files jdk1.7.0_95/jre/lib/charsets.jar and jre1.7.0_95/jdk1.7.0_95/jre/lib/charsets.jar differ
Only in jdk1.7.0_95/jre/lib: deploy
Only in jdk1.7.0_95/jre/lib: deploy.jar
Only in jdk1.7.0_95/jre/lib: desktop
Files jdk1.7.0_95/jre/lib/ext/localedata.jar and jre1.7.0_95/jdk1.7.0_95/jre/lib/ext/localedata.jar differ
Only in jdk1.7.0_95/jre/lib/images: icons
Only in jdk1.7.0_95/jre/lib: javaws.jar
Files jdk1.7.0_95/jre/lib/jfxrt.jar and jre1.7.0_95/jdk1.7.0_95/jre/lib/jfxrt.jar differ
Files jdk1.7.0_95/jre/lib/jsse.jar and jre1.7.0_95/jdk1.7.0_95/jre/lib/jsse.jar differ
Only in jdk1.7.0_95/jre/lib: locale
Only in jdk1.7.0_95/jre/lib: plugin.jar
Files jdk1.7.0_95/jre/lib/rt.jar and jre1.7.0_95/jdk1.7.0_95/jre/lib/rt.jar differ
Only in jdk1.7.0_95/jre/lib/security: javaws.policy
Only in jdk1.7.0_95/jre: plugin
Only in jdk1.7.0_95/lib: missioncontrol
Files jdk1.7.0_95/lib/tools.jar and jre1.7.0_95/jdk1.7.0_95/lib/tools.jar differ
Only in jdk1.7.0_95/man/ja/man1: javaws.1
Only in jdk1.7.0_95/man/ja_JP.UTF-8/man1: javaws.1
Only in jdk1.7.0_95/man/man1: javaws.1

# And the size of each:
$ du -sh jdk1.7.0_95/   jre1.7.0_95/jdk1.7.0_95/

301M    jdk1.7.0_95/
235M    jre1.7.0_95/jdk1.7.0_95/

In the end it really depends on your application as to which you should use. For vendor apps. I typically refer to their recommendations. If there are none, I use the JDK simply because it includes more "stuff" which I don't want to find out is needed at some later date as there is no easy way to exercise all use cases of an interactive app.

user3183018
  • 354
  • 1
  • 9