Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Eclipse can't find Java source code
Eclipse can't find Java source code [message #696715] Thu, 14 July 2011 17:22 Go to next message
daniel_jb1 is currently offline daniel_jb1Friend
Messages: 4
Registered: July 2011
Junior Member
Hi,

I have just started using Eclipse, having previously used NetBeans.

I would like to be able to CTRL + Click on a standard Java function in my code and have its source code displayed, as I believe is intended. However, if I try and do so, I get a screen with the following message:

Quote:
Class File Editor

Source not found
The JAR file C:\Program Files\Java\jre6\lib\rt.jar has no source attachment.
You can attach the source by clicking Attach Source below:


But regardless of which folder I choose I can't seem to get it to recognise the Java source code in the way that NetBeans did.

I have the following file:

C:\Program Files\Java\jdk1.6.0_21\src.zip

Can anyone advise me on what to do?

Thanks,

- Dan

[Updated on: Thu, 14 July 2011 17:23]

Report message to a moderator

Re: Eclipse can't find Java source code [message #696789 is a reply to message #696715] Thu, 14 July 2011 20:23 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
The recomended way would by to switch from using a jre to using the jdk inside of Eclipse. Go to Windows->Preferences->Java->Installed JREs. Select Browse and navigate to the C:\Program Files\Java\jdk1.6.0_21 directory. Eclipse will automatically find the source and associate it with the JDK classes.

If you still want to use the jre, go to Windows->Preferences->Java-Installed JREs. Select the jre you are using. Click Edit. In the resulting dialog select all the jar files. Click Source Attachment button. Navigate to the src.zip file you referenced in you message and select it.
Re: Eclipse can't find Java source code [message #719061 is a reply to message #696789] Thu, 25 August 2011 23:23 Go to previous message
daniel_jb1 is currently offline daniel_jb1Friend
Messages: 4
Registered: July 2011
Junior Member
Thanks! Switching to JDK did the trick!
Previous Topic:cannot be resolved
Next Topic:Internal Compiler Error (Java)
Goto Forum:
  


Current Time: Tue Mar 19 07:18:02 GMT 2024

Powered by FUDForum. Page generated in 0.01668 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top