Navigate Java stack trace in VS Code without debugger

Viewed 267

I have a Java project and a stack trace for an exception reported from a run of the Java project. There is no way to reproduce the exception, so I cannot attach and debug it.

Is there a way to load a copied stack trace into Visual Studio Code, so I can navigate through the code lines in the stack trace? If it is possible, what extension do I need to install and what are the steps?

(I know that I can achieve similar in IntellJ IDEA)

Example of a similar stack trace:

java.lang.NullPointerException: null
        at com.example.myproject.Book.getTitle(Book.java:16)
        at com.example.myproject.Author.getBookTitles(Author.java:25)
        at com.example.myproject.Bootstrap.main(Bootstrap.java:14)
``
1 Answers

Seems no such extension or tools to let you click the copied stack trace in another file then navigate to the error location.

When we run projects, the error and exception will be displayed in Terminal. We can right-click Java Progress Console and select Move into Editor Area to make it more readable. Ctrl+Click the sentence which includes line number will navigate to the exception location:

enter image description here

Related