Bolot
Bolot

Reputation: 95

Open file and go to a line in a java class in Eclipse when copying from a stacktrace

Is there an easy way to copy a string with a file and line number from a stack trace of a Java program to the clipboard and paste it in Eclipse somehow in order to go to that file and line. In other words instead of:

- copy the file name
- click Ctrl-Shft-T in Eclipse
- paste and hit enter
- copy the line number
- click Ctrl-L in Eclipse
- paste it and hit enter

to:

- copy the file and line number
- click some key combination in Eclipse
- paste it and hit enter

Upvotes: 0

Views: 106

Answers (1)

user4411382
user4411382

Reputation:

Yes, there is another way (although whether it's easier is debatable). From the stack trace, copy the text containing the fully-qualified class name, method name, and the filename and line number in brackets, e.g. com.whatever.myapp.mysubpackage.Myclass.mymethod(Myclass.java:1234)

In Eclipse, open the Console view, then from its Open Console button's menu, select 'Java stack trace console'. Paste the copied text into it. After that, you should only have to left-click the filename:linenumber link, to open the file at the given line number.

So in the above example, Eclipse would open (or switch to) the file Myclass.java, and scroll to and highlight all of line 1234.

Upvotes: 1

Related Questions