Editors note: This question was asked in 2009 where the world was different. In 2022 the standard open sourced OpenJDK is JDK-only.
What is the difference between JDK and JRE?
What are their roles and when should I use one or the other?
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.
The JRE is the Java Runtime Environment. It is a package of everything necessary to run a compiled Java program, including the Java Virtual Machine (JVM), the Java Class Library, the
javacommand, and other infrastructure. However, it cannot be used to create new programs.The JDK is the Java Development Kit, the full-featured SDK for Java. It has everything the JRE has, but also the compiler (
javac) and tools (likejavadocandjdb). It is capable of creating and compiling programs.Usually, if you only care about running Java programs on computer you will only install the JRE. It’s all you need. On the other hand, if you are planning to do some Java programming, you need to install the JDK instead.
Sometimes, even if you are not planning to do any Java development on a computer, you still need the JDK installed. For example, if you are deploying a web application with JSP, you are technically just running Java programs inside the application server. Why would you need the JDK then? Because the application server will convert JSP into Java servlets and needs to use the JDK to compile the servlets. I am sure that there are more examples.