Possible Duplicate:
Java SE 6 vs. JRE 1.6 vs. JDK 1.6 – What do these mean?
I found that sometimes applications ask for java_home to point to a JDK and won’t work with a JRE.
Why is that the case? Is it correct?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Short version: some applications use libraries/code that is contained only in the JDK.
Longer version: Usually every Java program should be able to run with just the JRE. And most applications actually work with the JRE.
Now the JDK comes with some additional libraries and tools that you usually only need when developing applications (and not when you simply need to run them).
But occasionally an application decides to use some of the code that gets delivered with the JDK when it runs. It’s very rare and is usually not a good idea (unless that application is itself about developing Java applications).
A good example where old versions of Apache Tomcat: it used the Java compiler bundled with the JDK to compile JSP code into bytecode. For this it used
tools.jarwhich is included in the JDK but doesn’t get delivered with the JRE.Newer Tomcats switched to a separate compiler (I think it’s based on the Eclipse compiler) for this and no longer require the JDK: they run just fine with just the JRE.
@Rekin mentioned another good example: Maven uses the JDK because it actually compiles Java code.