javavisual-studio-codeconditional-breakpoint

Conditional Breakpoints in Visual Studio Code JAVA


I've looked around the Stackoverflow and few youtube videos but no one seems to know how to set up conditional breakpoints in VS Code JAVA environment.

The task should be simple: compare String to some "string" and break if true. Please write examples. Thanks!


Solution

  • I suppose you have already installed an extension for Java Debugging
    This is the standard
    Then you setup a normal breakpoint > Rightclick on the BP > Edit Breakpoint

    mystring.equals("String");[ENTER]
    

    If you pressed Enter, the BP will break when your String is equal to "String". Your breakpoint should looks like a red dot with a black equal sign inside.
    Direct link to conditional BP.