What is the difference between JDK and JRE?

前端 未结 20 1644
孤独总比滥情好
孤独总比滥情好 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 03:54

    suppose, if you are a developer then your role is to develop program as well as to execute the program. so you must have environment for developing and executing, which is provided by JDK.

    suppose, if you are a client then you don't have to worry about developing.Just you need is, an environment to run program and get result only, which is provided by JRE.

    JRE executes the application but JVM reads the instructions line by line so it's interpreter.

    JDK=JRE+Development Tools

    JRE=JVM+Library Classes

    0 讨论(0)
  • 2020-11-22 03:56

    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 java command, 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 (like javadoc and jdb). 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.

    0 讨论(0)
  • 2020-11-22 03:58

    JVM, JRE and JDK are platform dependent because configuration of each OS differs. But, Java is platform independent.

    Java Virtual Machine (JVM) is a run-time system that executes Java bytecode.

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

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

    0 讨论(0)
  • 2020-11-22 03:58

    jdk is necessary to compile to code and convert java code to byte codes while jre is necessary for executing the byte codes.

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

    A clear understanding of these terms(JVM, JDK, JRE) are essential to grasp their usage and differences.

    JVM Java Virtual Machine (JVM) is a run-time system that executes Java bytecode. The JVM is like a virtual computer that can execute a set of compiled instructions and manipulate memory locations. When a Java compiler compiles source code, it generates a highly optimized set of instructions called bytecode in a .class file. The JVM interprets these bytecode instructions and converts them to machine-specific code for execution.

    JDK The Java Development Kit (JDK) is a software development environment that you can use to develop and execute Java applications. It includes the JRE and a set of programming tools, such as a Java compiler, interpreter, appletviewer, and document viewer. The JDK is implemented through the Java SE, Java EE, or Java ME platforms.

    JRE The Java Runtime Environment (JRE) is a part of the JDK that includes a JVM, core classes, and several libraries that support application development. Though the JRE is available as part of the JDK, you can also download and use it separately.

    For complete understanding you can see my Blog : Jdk Jre Jvm and differences

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

    The difference between JDK and JRE is that JDK is the software development kit for java while JRE is the place where you run your programs.

    0 讨论(0)
提交回复
热议问题