Good afternoon, doing Java.

jdk and jre are in Program Files / Java

Netbeans (out of the box) connects the JDK to it when creating a project, and you can view the source code for any class from it.

But eclipse ("out of the box") does not give a look at the source code. In the list of project files there is JRE, and with "ctrl + click" on any class / method produces: Source not found and, for example ... Java \ jre7 \ lib \ rt.jar no source attachment.

Is it generally normal that he refers to a separate jre? After all, in theory, jre, which is part of jdk, is the necessary jre, isn't it?

Do not tell me how to be?

Thank you in advance!

  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

2 answers 2

For development, you must use the JDK, it has the source code of the classes. Go to Window-Preferences-Java-Installed JREs and specify the path to the installed JDK (for example, c: \ Program Files \ Java \ jdk1.7.0).

After checking the project settings: Properties-Java Build Path-Libraries and install the correct version for JRE System Library there

It looks like you have eclipse using the JRE to work, you can fix it in eclipse.ini

-vm c:/Program Files/Java/jdk1.7.0_10/bin/javaw.exe 
  • Everything worked out! Thank you very much! - Erys
  • @Erys If the answer is correct, you must accept the answer and thank Misha by adding his reputation. Thanks here is not a channel. - Barmaley

PS Absolutely the same way you can connect to the source JDK, if you are working purely on Java. To do this, you need to connect the src.zip file to the rt.jar library, located in the root of the folder where your JDK is installed.

link to habr

  • Although the answer should be counted as correct - there are technical notes to the writing of the answer. It, in fact, consists of a single link to an external resource. And links tend to foul (on the same Habre UFO can cut). Therefore, I recommend briefly describing a significant part of the answer directly in the text of the answer. For the rest - welcome to Ruso! - AK