In Code: System.out.println(\"myPackage.MyClass\");
In Eclipse Console: myPackage.MyClass.myMethod
I want to click on the output (myPackage.MyClass.myM
Maybe this is clear to other people, but I found the other answers confusing, although correct. The eclipse console parses the pattern (FileName.java:lineNumber) to be a link to that line in that file:
(MyFile.java:2)
As the other answers point out, there are many ways to output this to the console. Location in the line does not matter, it is just a pattern match. As Colin Smith shows, log4j PatternLayout can use (%F:%L)
to get the file name and line number. To get the file name and line number programmatically see this question.
The question asks about linking to a method and I believe you could use the consolePatternMatchListeners method recommended by Tonny Madsen and described in more detail in this question.