Difference Between JDK and JRE in Java
JDK and JRE are the core concepts in Java programming and their differences are some of the most popular interview questions. We don’t use these concepts while programming but if we want to become a Java developer, we must know about these concepts.
JDK stands for Java Development Kit. It is a software development environment used to develop Java applications and applets. It is a platform-specific software i.e there are separate installers for Windows, Mac, and Unix systems. Java developers can use it on their Windows, macOS, Solaris, and Linux to code and run Java programs. It contains Java Runtime Environment(JRE) and other development tools like an interpreter, compiler, archiver, and a document generator. We can possibly install more than one JDK version on the same computer.
JRE stands for Java Runtime Environment. It is the implementation of JVM (Java Virtual Machine) and it is specially designed to provide an environment to execute Java programs. It is also platform dependent like JDK. It consists of JVM, Java binaries, and other classes for the smooth execution of the program. It doesn’t contain any development tools like a compiler, debugger, etc. If we only want to execute a program, we just need to install JRE and not JDK, since there is no development or compilation of the code required.
Let’s see the main difference with the help of the below diagram:
Difference Between JDK and JRE
|DEFINITION||JDK(Java Development Kit) is used to develop Java applications. JDK also contains numerous development tools like compilers, debuggers, etc.||JRE(Java Runtime Environment) is the implementation of JVM(Java Virtual Machine) and it is specially designed to execute Java programs.|
|FUNCTIONALITY||It is mainly used for the execution of code and its main functionality is development.||It is mainly used for creating an environment for code execution.|
|DEPENDENCY OF PLATFORM||It is platform-dependent.||It is also platform-dependent like JDK.|
|TYPE OF TOOLS||Since JDK is responsible for the development purpose, therefore it contains tools which are required for development and debugging purpose.||On the other hand, JRE is not responsible for development purposes so it doesn’t contain such tools as the compiler, debugger, etc. Instead, it contains class libraries and supporting files required for the purpose of execution of the program.|
|IMPLEMENTATION OF JDK AND JRE||JDK = JRE + other development tools.||JRE = JVM + other class libraries.|