Eclipse debugging shows source files with incorrect line numbers

when I press F3 and proceed to the definition of the method, eclipse goes into the jar of dependency. ----- first question: where did he get the source file? I do not see banks containing actual source files, decompiled? ---- I set a breakpoint and run debug.

but the debugging process never seems to land on the correct breakpoint, and the set breakpoint is rarely executed. it turns out that the source code is not shown correctly, so the breakpoint is also set in the wrong places.

Here is what I see from the eclipse window:

/* */ public <T> T execute(URI url, HttpMethod method, RequestCallback requestCallback, ResponseExtractor<T> responseExtractor) /* */ throws RestClientException /* */ { /* 415 */ return doExecute(url, method, requestCallback, responseExtractor); /* */ }` 

the comment before each line seems to show the correct line number, but they do not match their true line number shown to the left of the eclipse window window. that is, the above code segment occupies lines 315-319 in the window, not 415.

so how can i capture the correct sources and display them in the debugging process? Do I need to manually grab all the cans? is there any way to specify pom in my file?

thanks yang

+8
debugging eclipse
source share
2 answers

In Eclipse, you can specify the sources for debugging in the section "Run -> Debug Configurations". Select the Debug configuration from the list and configure the source search path on the Source tab

+3
source share

Since I did not find a solution when I was looking for it, and this is the first search result, I want to share how I solved this problem.

  • In Eclipse, make sure Project > Build Automatically checked;
  • Right click in your project and select to Build Path > Configure Build Path...
  • Check the tabs for errors (missing dependencies, no sources found, etc.), fix / delete them and click OK.
  • In Eclipse, go to Project > Clean... , select your project and click OK;

If you get errors in step 3 (for example, Access denied or similar), go to the root folder of your project and find the file named .classpath . Edit the file and manually correct / delete the block causing the error.

It also solves when Eclipse does not display error icons in classes with compilation errors.

+2
source share

All Articles