乐闻世界logo
搜索文章和话题

What's the Difference Between JVM and JRE?

2月7日 12:46

JVM (Java Virtual Machine) and JRE (Java Runtime Environment) are two primary components of the Java platform, each serving distinct purposes and functions.

  1. JVM (Java Virtual Machine):

    • JVM is a virtual machine that provides a runtime environment for Java bytecode; it does not include any runtime libraries itself.
    • JVM is responsible for loading, verifying, compiling, and executing bytecode, enabling cross-platform capabilities, i.e., "write once, run anywhere".
    • JVM also manages memory, including garbage collection.
  2. JRE (Java Runtime Environment):

    • JRE includes the JVM and runtime libraries, such as the Java class libraries (java.* packages), user interface toolkits, and network libraries, which provide essential support for executing applets and applications.
    • JRE is the runtime environment that executes Java programs on the user's machine, ensuring compatibility across various platforms.

In summary, JVM handles the execution of Java programs, while JRE provides the necessary environment for execution, encompassing the JVM and additional runtime libraries.

标签:Java