javadebuggingvisual-studio-codevscode-debugger

How to set a breakpoint in java class dependency in VScode


I have have a Java project under VScode debugger and would like to set a breakpoint to a method which is only available as a compiled .class file (from a jar package which came as a dependency in maven project).

Since it is not a .java file in my VScode project, I cannot simply open the file from the file browser and set a breakpoint in the file.

How can I set a breakpoint when I only know the method and class by name?


Solution

  • The following hack worked for me:

    1. Create a variable of the class you want to set a breakpoint in.
    2. Ctrl-click the class of the variable to get VSCode to open the class's file.
    3. Profit.