运行 Eclipse 在 jvm.dll 和 java.exe(或 javaw.exe)上的区别

Difference between running Eclipse on jvm.dll and java.exe (or javaw.exe)

使用jvm.dlljava.exe作为Eclipse的JVM有什么区别运行 在?


免责声明
我已将此问题连同答案一起发布,因为我发现此信息很有用并想与其他人分享。

未指定 -vm 时如何启动 Eclipse

好的,只是为了解决一个困惑:在 Windows 上全新安装的 Eclipse 没有在 [=94= 中指定的 -vm 配置]个文件。

让我们看看官方 Equinox Launcher documentation 对未指定 -vm 的情况(强调我的)的说法:

When no -vm is specified, the launcher looks for a virtual machine first in a JRE directory in the root of eclipse and then on the search path. If Java is found in either location, then we look for a JVM shared library (jvm.dll on Window, libjvm.so on *nix platforms) relative to that Java executable.

  • If a JVM shared library is found we load it and use the JNI invocation API to start the vm
  • If no JVM shared library is found, we exec the Java launcher to start the vm in a new process

所以如你所见,jvm.dll是第一个搜索的,如果没有找到,那么Java 启动器(即 java.exe 或 javaw.exe)被使用。


使用jvm.dlljavaw.exe(或java.exe)

  • 当使用jvm.dll时,Eclipse使用JNI调用API来 在当前进程 中启动虚拟机。您将在任务管理器中只看到一个进程:
    eclipse.exe

  • 当使用 javaw.exe(或 java.exe)时,Eclipse 执行 Java 用于在新进程 中启动虚拟机的启动器。您将在任务管理器中看到两个进程:

  1. eclipse.exe
  2. javaw.exe(或 java.exe 如果已配置)

javaw.exe 将是 [=] 的 sub-process(子进程) 102=]进程。

所以选择权在你。


其他想法

最推荐使用的选项之一是为 Eclipse 指定一个特定的 JVM 运行。这样做可以确保您绝对确定 Eclipse 将 运行 进入哪个 JVM,并使您免受可能改变系统“默认”JVM 的系统更改的影响。在这里阅读更多:Specifying the JVM