File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes Debugging in Eclipse, Source not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Debugging in Eclipse, Source not found" Watch "Debugging in Eclipse, Source not found" New topic
Author

Debugging in Eclipse, Source not found

Sean Booysen
Greenhorn

Joined: Jul 19, 2012
Posts: 4
Hi All,

My first post and hopefully 1 of many more for what looks like a great community.

I just started using Java and Eclipse (Juno). While trying to debug a program I am getting a source not found error but when I press F3 I can view the source code for the offending line.

This is an example line:
SessionSettings settings = new SessionSettings(inputStream);

It causes the "Source not found" error when I try step into it with F5.

Yet SessionSettings.java exists and I can easily view the code.

I must be missing something simple, but can't find what it is, despite a lot of searching.
BalaMurali dhar
Ranch Hand

Joined: Apr 14, 2012
Posts: 60
there is a problem with your code.
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2850
    
  11

Hi Sean, welcome to JavaRanch!

Yes, Eclipse is baffling sometimes. Here's something to try. Right-click on your project, then click on Properties. In the Properties dialog, click on Java Build Path. In the Source tab, you should see the folder where your Java code is. If not, then add it. That may be the problem, but just in case, I'm going to move this thread to our IDE forum, where the real experts can take a crack at it.
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1020
    
    5

Sean

When running in debug mode, right click on the running thread (in threads tab) and select Edit Source Lookup. At this point, you should be able to add the necessary project/jar which contains your source code.
Sean Booysen
Greenhorn

Joined: Jul 19, 2012
Posts: 4
Thanks for the suggestions. I have looked at the Build Path and it seems to have the source code path linked. I say "seems" because this is an open source project I am trying to debug and the Project structure is quite complicated. If I try explicitly add the directory with the source code it causes all sorts of other errors, probably caused by conflicting sources?

The project is the QuickFIXJ project, the Banzai example.

The other issue I am finding is that it when I press F5 it also tries to move into the actual Java SDK source. I would not expect this as I am sure people don't want to step through the entire Java source code while debugging their programs! So I probably have some setting that I am missing as I only want to debug the code relevant to the project.

Notice that the issue is occurring with the "new" functionality ("SessionSettings settings = new SessionSettings(inputStream);"). I would have thought that this would move to the source code containing the class definition, namely SessionSettings.java, but perhaps it is moving into the internal Java code for class instantiation, and then saying source not found?
Sean Booysen
Greenhorn

Joined: Jul 19, 2012
Posts: 4
Thanks to a friend of mine this problem is solved. Enabling step filters in order to prevent stepping into JDK code solves the problem, since I don't have the source code for the JDK.
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2850
    
  11

Ah, so you were stepping into a Java API class, not your own code? In any case, thanks for coming back to this thread and posting your solution!
Sean Booysen
Greenhorn

Joined: Jul 19, 2012
Posts: 4
Well the last line of code before pressing F5 was my own, but from there it was stepping into the JDK without me realizing it. Never even crossed my mind really because it is not something that would happen with C++ or C# debuggers
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2850
    
  11

F5 means Step Into. If you want don't want to Step Into, use F6, Step Over. I'm extremely skeptical of your implied claim that you can't step into C-sharp API classes. Hang on, we've got an emoticon for that ... ah, here it is:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Debugging in Eclipse, Source not found