简体   繁体   English

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

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

What is the difference between using jvm.dll and java.exe as the JVM for Eclipse to run on? 使用jvm.dlljava.exe作为运行Eclipse的JVM有什么区别?


DISCLAIMER 免责声明
I have posted this question along with the answer because I find this information useful and want to share this with others. 我将这个问题和答案一起发布了,因为我发现此信息很有用,并希望与他人分享。

How Eclipse is launched when no -vm is specified 未指定-vm时如何启动Eclipse

OK, just to resolve a confusion: fresh installation of Eclipse on Windows has no -vm configuration specified in the eclipse.ini file. 好的,只是为了解决一个混乱:Windows上的Eclipse全新安装在eclipse.ini文件中没有指定-vm配置。

Let's see what the official Equinox Launcher documentation says about situation when no -vm is specified (emphasis mine): 让我们看看Equinox Launcher官方文档中有关未指定-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. 如果未指定-vm,启动程序将首先在eclipse根目录的JRE目录中查找虚拟机,然后在搜索路径中查找。 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. 如果在任一位置都找到Java,则我们将寻找相对于该Java可执行文件的JVM 共享库 (Window上的jvm.dll ,* nix平台上的libjvm.so )。

  • If a JVM shared library is found we load it and use the JNI invocation API to start the vm 如果找到了JVM 共享库 ,我们将其加载并使用JNI调用API来启动虚拟机。
  • If no JVM shared library is found , we exec the Java launcher to start the vm in a new process 如果未找到JVM共享库 ,我们将执行Java启动器以新流程启动vm。

So as you can see, the jvm.dll is the one that is searched for in the first place, and ONLY if it is not found, THEN the Java launcher (ie java.exe or javaw.exe) is used. 如您所见,首先搜索的是jvm.dll ,只有在未找到的情况下,才使用Java启动器(即java.exe或javaw.exe)。


Difference between using jvm.dll and javaw.exe (or java.exe ) 使用jvm.dlljavaw.exe (或java.exe )之间的区别

  • When using jvm.dll Eclipse uses the JNI Invocation API to start the vm in the current process . 当使用jvm.dll时, Eclipse使用JNI Invocation API 在当前进程中启动vm。 You will see only ONE process in the task manager: 您将在任务管理器中仅看到一个进程:
    eclipse.exe eclipse.exe

  • When using javaw.exe (or java.exe ) Eclipse executes that Java Launcher to start the vm in a new process . 当使用javaw.exe (或java.exe )时,Eclipse执行该Java Launcher以在新进程中启动vm。 You will see TWO processes in the task manager: 您将在任务管理器中看到两个流程:
    1) eclipse.exe 1) eclipse.exe
    2) javaw.exe (or java.exe if it was configured) 2) javaw.exe (如果已配置,则为java.exe

    The javaw.exe will be the sub-process (child process) of the eclipse.exe process. javaw.exe将成为eclipse.exe进程的子进程 (子进程)。

So the choice is up to you. 因此,选择取决于您。 Read the following article which nicely explains and illustrates possible consequences of using either jvm.dll or javaw.exe : Eclipse.exe and windows processes 阅读下面的文章,它很好地解释和说明了使用jvm.dlljavaw.exe的可能后果: Eclipse.exe和Windows进程


Other thoughts 其他想法

One of the most recommended options to use is to specify a specific JVM for Eclipse to run on. 最推荐使用的选项之一是为Eclipse 指定一个特定的JVM Doing this ensures that you are absolutely certain which JVM Eclipse will run in and insulates you from system changes that can alter the "default" JVM for your system. 这样做可以确保您完全确定将在哪个JVM Eclipse中运行,并使您免受可能会更改系统“默认” JVM的系统更改的影响。 Read more here: Specifying the JVM 在此处了解更多信息: 指定JVM

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM