Reputation: 62722
I am running my java app through the "Run" button, not "Debug".
However, if certain condition is met I would like to break into the debugger.
I do not want to run it with a conditional breakpoint through the "Debug" button, because this particular conditional breakpoint will be tested thousands and thousands of times, slowing the overall execution considerably.
I could have an if statement with a breakpoint inside, however, I have noticed that the "Debug" configuration is generally significantly slower than the "Run" configuration.
Essentially, I am looking for the Debugger.Launch()
equivalent of .NET.
Upvotes: 1
Views: 338
Reputation: 401887
In Run mode JVM is started without debug options and doesn't accept connections from the debugger, so there is no way to force debug a JVM that was not started in Debug mode.
Using Remote Debug can be an option. You may connect to the VM with the Remote Debug configuration only when needed. But it should be no different from the local debug configuration when all the breakpoints are muted. When you want to debug, just unmute the breakpoints. As for the performance, check the corresponding FAQ.
Upvotes: 2