开发者

Eclipse: XXX is not a valid line number in YYY

While debugging a large scale project, I use links in the log printout to jump straight to the relevant fi开发者_如何转开发le and line. Alas in many cases I get the following pop-up:

XXX is not a valid line number in YYY.java

On the main sub-window there's also the following message:

The JAR file M2_REPO\org\apache\...\some.jar has no source attachment.

Of course I checked that:

  • M2_REPO (defined under Window\Preferences\Java\Build Path\Classparth Variables) points to the maven repository correctly
  • the path and filename in the message above is correct and the file exists
  • YYY.java has line XXX and indeed it is the source of the log message

What could possibly make eclipse mistake in this trivial task?

What other configuration might be set wrong?


Press Ctrl+Shift+R and enter YYY.java. Eclipse will then tell you which YYY.java it can see. Chances are that it sees more or other source files than you expect.

If there is just a single file, make sure it's the correct version. Maybe Eclipse mixes a new bytecode JAR with an old source JAR.

The maven error message means that it's missing M2_REPO\org\apache\...\some-version-sources.jar This file must be in the same directory as some-version.jar for Eclipse to attach the sources to the binary JAR.

If you have the sources, copy it there. If you don't have them, there is a chance that Eclipse can download them for you. Open the context menu for the project -> Maven -> Download sources ... wait ...


I just experienced the same issue. I was using the apache tomcat debugger and had the following line in the output:

SERVER: 2015 Jul 05, 13:11:58.311 (http-nio-8080-exec-4) DEBUG - (ForwardActionBean.java:41) forward

Clicking on the link in the output window gave me the error "41 is not a valid line number in ForwardActionBean.java"

The problem was: I had two projects open and each had a class called ForwardActionBean

The solution was: remove the project I wasn't working on from eclipse.

Hope this helps the next person that comes across this issue.

Also, it's important to make sure line numbers are being generated by the compiler (this is the default behavior so it is probably not the source of the problem). This can be checked by selecting window->preferences->java->compiler

Eclipse: XXX is not a valid line number in YYY


Just simply restore your java compiler settings to default and uninstall your any decompiler add-on in your Eclipse, and the problem is solved!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜