What is the difference between JDK and JRE?

前端 未结 20 1535
孤独总比滥情好
孤独总比滥情好 2020-11-22 03:31

What is the difference between JDK and JRE?

What are their roles and when should I use one or the other?

相关标签:
20条回答
  • 2020-11-22 04:13

    Simply :

    JVM is the virtual machine Java code executes on

    JRE is the environment (standard libraries and JVM) required to run Java applications

    JDK is the JRE with developer tools and documentation

    0 讨论(0)
  • 2020-11-22 04:14

    In layman terms: JDK is grandfather JRE is father and JVM is their son. [i.e. JDK > JRE > JVM ]

    JDK = JRE + Development/debugging tools

    JRE = JVM + Java Packages Classes(like util, math, lang, awt,swing etc)+runtime libraries.

    JVM = Class loader system + runtime data area + Execution Engine.

    In other words if you are a Java programmer you will need JDK in your system and this package will include JRE and JVM as well but if you are normal user who like to play online games then you will only need JRE and this package will not have JDK in it.

    JVM :

    The Java Virtual Machine (JVM) is the virtual machine that run the Java bytecodes. The JVM doesn't understand Java source code, that's why you compile your *.java files to obtain *.class files that contain the bytecodes understandable by the JVM. It's also the entity that allows Java to be a "portable language" (write once, run anywhere). Indeed there are specific implementations of the JVM for different systems (Windows, Linux, MacOS, see the wikipedia list..), the aim is that with the same bytecodes they all give the same results.

    JDK and JRE

    To explain the difference between JDK and JRE, the best is to read the Oracle documentation and consult the diagram :

    Java Runtime Environment (JRE)

    The Java Runtime Environment (JRE) provides the libraries, the Java Virtual Machine, and other components to run applets and applications written in the Java programming language. In addition, two key deployment technologies are part of the JRE: Java Plug-in, which enables applets to run in popular browsers; and Java Web Start, which deploys standalone applications over a network. It is also the foundation for the technologies in the Java 2 Platform, Enterprise Edition (J2EE) for enterprise software development and deployment. The JRE does not contain tools and utilities such as compilers or debuggers for developing applets and applications.

    Java Development Kit (JDK)

    The JDK is a superset of the JRE, and contains everything that is in the JRE, plus tools such as the compilers and debuggers necessary for developing applets and applications.

    Note that Oracle is not the only one to provide JDK.

    JIT Compile Process (Courtesy: Oracle documentation)

    0 讨论(0)
  • 2020-11-22 04:14

    If you want to run Java programs, but not develop them, download the Java Run-time Environment, or JRE. If you want to develop them, download the Java Development kit, or JDK

    JDK

    Let's called JDK is a kit, which include what are those things need to developed and run java applications.

    JDK is given as development environment for building applications, component s and applets.

    JRE

    It contains everything you need to run Java applications in compiled form. You don't need any libraries and other stuffs. All things you need are compiled.

    JRE is can not used for development, only used for run the applications.

    0 讨论(0)
  • 2020-11-22 04:15

    enter image description here

    JDK is a superset of JRE, and contains everything that is in JRE, plus tools such as the compilers and debuggers necessary for developing applets and applications. JRE provides the libraries, the Java Virtual Machine (JVM), and other components to run applets and applications written in the Java programming language.

    0 讨论(0)
  • 2020-11-22 04:16

    JDK includes the JRE plus command-line development tools such as compilers and debuggers that are necessary or useful for developing applets and applications.

    JRE is basically the Java Virtual Machine where your Java programs run on. It also includes browser plugins for Applet execution.

    JDK is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed.

    So, Basically JVM < JRE < JDK as per @Jaimin Patel said.

    0 讨论(0)
  • 2020-11-22 04:17

    From Official java website...

    JRE (Java Runtime environment):

    • It is an implementation of the Java Virtual Machine* which actually executes Java programs.
    • Java Runtime Environment is a plug-in needed for running java programs.
    • The JRE is smaller than the JDK so it needs less Disk space.
    • The JRE can be downloaded/supported freely from https://www.java.com
    • It includes the JVM , Core libraries and other additional components to run applications and applets written in Java.

    JDK (Java Development Kit)

    • It is a bundle of software that you can use to develop Java based applications.
    • Java Development Kit is needed for developing java applications.
    • The JDK needs more Disk space as it contains the JRE along with various development tools.
    • The JDK can be downloaded/supported freely from https://www.oracle.com/technetwork/java/javase/downloads/
    • It includes the JRE, set of API classes, Java compiler, Webstart and additional files needed to write Java applets and applications.
    0 讨论(0)
提交回复
热议问题