且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

完全与 java.exe 混淆

更新时间:2023-12-03 23:18:58

java.exe 既不是 JVM 也不是解释器.它是一个启动器 - 一个通常用 C 编写的小程序,它执行以下操作:

java.exe is neither a JVM nor an interpreter. It is a launcher - a small program typically written in C which does the following:

  1. 找到已安装的 JRE
  2. 加载 JVM 动态库 (jvm.dll)
  3. 使用 调用 API创建一个新的 Java 虚拟机>
  4. 找到主类并使用 JNI
  1. Locates an installed JRE
  2. Loads JVM dynamic library (jvm.dll)
  3. Creates a new Java Virtual Machine using the Invocation API
  4. Finds the main class and calls the main() method using JNI

JRE 大致包括

  1. JVM - jvm.dll
  2. 类库 - rt.jar
  3. 原生库 - 类库和操作系统平台之间的层,例如java.dllnet.dllnio.dllawt.dll
  4. 资源 - 字体、属性、字符串等

现在,字节码解释器、字节码验证器、类加载器、JIT 编译器、垃圾收集器和许多其他很酷的东西 - 都是 Java 虚拟机的组成部分.

Now, the Bytecode Interpreter, the Bytecode Verifier, the Class Loader, the JIT compiler, the Garbage Collector and many other cool stuff - are all parts of the Java Virtual Machine.