简体   繁体   English

在 Eclipse 中使用 JRE 与 JDK(已安装的 JRE?!),哪个更好?

[英]Using JRE vs JDK (installed JREs?!) in Eclipse, what´s better?

I have just noticed that my Eclipse (version Luna) was running on the JRE instead of the JDK.我刚刚注意到我的 Eclipse(版本 Luna)运行在 JRE 而不是 JDK 上。 I was wondering about that, because my environment variables are set correctly as !User-Variables!我想知道这一点,因为我的环境变量被正确设置为 !User-Variables! (JAVA_HOME and added into the PATH-value). (JAVA_HOME 并添加到 PATH 值中)。

I'm not an absolute beginner, so I surely know that JDK is for developers (as the name suggests) and also includes JRE.我不是一个绝对的初学者,所以我肯定知道 JDK 是为开发人员准备的(顾名思义)并且还包括 JRE。 I`m just totally amazed that Eclipse, which is built to develope, only access to the Runtime Environment.我完全惊讶于 Eclipse,它是为开发而构建的,只能访问运行时环境。

Maybe I´m wrong and at the configuration "installed JREs" it only gets access to things like the JVM etc. and gets access to JDK at another point?!也许我错了,在“安装的 JRE”配置中,它只能访问 JVM 等内容,并在另一点访问 JDK?!

I stumbled upon this while I´m trying to fix a problem with parameter names from standard class methods (got arg0, arg1 etc.) and saw that the javadoc was not attached.我在尝试解决来自标准类方法(得到 arg0、arg1 等)的参数名称的问题时偶然发现了这一点,并发现未附加 javadoc。

Now I want to know if I should select JRE or JDK at Windows => Preferences => Java => Installed JREs?现在我想知道我是否应该在 Windows => Preferences => Java => Installed JREs 中选择 JRE 或 JDK? I dare guess that running a programm with JDK configured would slow it because the folder of JDK includes more data and therefore has a bigger size.我敢猜测运行配置了 JDK 的程序会减慢它的速度,因为 JDK 的文件夹包含更多数据,因此具有更大的大小。 What´s the "normal" configuration?!什么是“正常”配置?!

I just want to configure Eclipse correctly and close my knowledge gap, I obviously have at this context.我只想正确配置 Eclipse 并缩小我的知识差距,我显然在这种情况下有。

It's probably best to configure a JDK for programming in Eclipse.最好为 Eclipse 中的编程配置一个 JDK。 Is not that a JRE won't run your program, because it will (it includes the JVM executable anyway).不是说 JRE 不会运行您的程序,因为它会(无论如何它都包含 JVM 可执行文件)。 The thing is, using the JDK will give you access to the JDK source code (and javadoc) which is more likely what you want.问题是,使用 JDK 将使您能够访问更可能是您想要的 JDK 源代码(和 javadoc)。

Furthermore, you may need to develop for a certain Java version, but run Eclipse with another one.此外,您可能需要针对某个 Java 版本进行开发,但使用另一个版本运行 Eclipse。 That is why Eclipse lets you configure several Java JREs/JDK.这就是 Eclipse 允许您配置多个 Java JRE/JDK 的原因。 Also, the JDK includes some other tools that you may eventually need (compare the executables included in one and the other).此外,JDK 还包括一些您最终可能需要的其他工具(比较其中一个和另一个中包含的可执行文件)。 So go with the JDK and leave the JRE for the users of your program.因此,使用 JDK 并将 JRE 留给程序的用户。

One last thing.最后一件事。 There's a misconception in your statement regarding program speed execution and the size of the JDK folder.您关于程序速度执行和 JDK 文件夹大小的陈述存在误解。 In general, the size a program takes in disk in not related with how "fast" or "slow" it would run.一般来说,程序占用磁盘的大小与它运行的“快”或“慢”无关。 The speed of your program depends on too many things to be mentioned here, but in the scope of your question, it depends on the JVM executable and your code of course, and both will be the same, should you go with the JDK or the JRE.你的程序的速度取决于这里要提到的太多东西,但在你的问题范围内,它当然取决于 JVM 可执行文件和你的代码,如果你使用 JDK 或JRE。

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

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