Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. I was wondering about that, because my environment variables are set correctly as !User-Variables! (JAVA_HOME and added into the PATH-value).

I'm not an absolute beginner, so I surely know that JDK is for developers (as the name suggests) and also includes JRE. I`m just totally amazed that Eclipse, which is built to develope, only access to the Runtime Environment.

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?!

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.

Now I want to know if I should select JRE or JDK at Windows => Preferences => Java => Installed JREs? 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. What´s the "normal" configuration?!

I just want to configure Eclipse correctly and close my knowledge gap, I obviously have at this context.

like image 887
monty.py Avatar asked Jan 04 '15 00:01

monty.py


1 Answers

It's probably best to configure a JDK for programming in Eclipse. Is not that a JRE won't run your program, because it will (it includes the JVM executable anyway). The thing is, using the JDK will give you access to the JDK source code (and javadoc) which is more likely what you want.

Furthermore, you may need to develop for a certain Java version, but run Eclipse with another one. That is why Eclipse lets you configure several Java JREs/JDK. Also, the JDK includes some other tools that you may eventually need (compare the executables included in one and the other). So go with the JDK and leave the JRE for the users of your program.

One last thing. There's a misconception in your statement regarding program speed execution and the size of the JDK folder. 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.

like image 139
jotadepicas Avatar answered Oct 17 '22 04:10

jotadepicas