Reputation: 511
Would someone be able to summarize all advantages from using Oracle Java JDK over JRE in a server environment (i.e. for Tomcat) for me? Using my prefered search engine I could only find fragments, which partially contradict themselves.
Upvotes: 0
Views: 476
Reputation: 4695
My overall assessment of the situation is that what we get from these packages (JDK, JRE) is decided by the packaging team. To some extent, it is arbitrary. Let's see how, using the OpenJDK 7 packages on an Ubuntu system:
➜ ~ ls /usr/lib/jvm/java-7-openjdk-amd64/jre/bin
java keytool orbd pack200 policytool rmid
rmiregistry servertool tnameserv unpack200
➜ ~ ls /usr/lib/jvm/java-7-openjdk-amd64/bin
appletviewer idlj java javah jcmd jhat jps
jstack keytool pack200 rmid serialver unpack200
xjc apt jar javac javap jconsole jinfo
jrunscript jstat native2ascii policytool rmiregistry servertool
wsgen extcheck jarsigner javadoc java-rmi.cgi jdb jmap
jsadebugd jstatd orbd rmic schemagen tnameserv
wsimport
The first location is because of the package openjdk-7-jre
(Java Runtime Environment), whereas the second location is because of openjdk-7-jdk
(Java Development Kit) package. The java
in second listing is actually a symbolic link to the java
file from the first listing.
You can thus see what the JDK team thinks is the difference between the JRE and JDK is by comparing the programs (executables) that you get as part of these packages.
For a long long time, I have been rather confused by the choice of programs that are part of these packages. For instance, I have always missed the excellent serviceability tools like jps
, jstack
, and jhat
, jmap
when I installed only the JRE. These tools are very useful to diagnose a Java runtime and yet, they are not a part of the JRE. One has to, rather inexplicably, install the JDK in order to get these tools. Like others have pointed out, javac
, the Java compiler definitely belongs to the JDK.
In general, I have come to the conclusion that one should install the JDK (the superset) and not the JRE on the target system, unless there are some space issues.
Upvotes: 1
Reputation: 5828
Tomcat has a bundled java compiler, so it works fine with just JRE. And less things you have on your server, the safer you are.
Upvotes: 0