• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Debugging in Eclipse, Source not found

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there is a problem with your code.
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
reply
    Bookmark Topic Watch Topic
  • New Topic