Netbeans has a tabbed window in the Output section called “Debugger Console”. Is it possible to write a message to this window using Java? If so, how?
Netbeans has a tabbed window in the Output section called Debugger Console. Is it
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The messages you see in the debugger console are either
When you add a breakpoint to a line of code, the default behavior of the breakpoint is to suspend the thread that executed the line of code, and to print the text
"Breakpoint hit at line {lineNumber} in class {className} by thread {threadName}.".You can configure a breakpoint to print a custom text. This text will be output in the debugger console when it reaches the breakpoint. To do so, right click on a breakpoint, open the propoerties window, and enter your text in the field
Print text.A useful trick is to configure a breakpoint so that it does not block (
suspend : no thread), and to enter a text. The effect is the same than addingprintlnlines in your code, but the benefit is that you don’t have to recompile the code, and it’s easier to activate/deactivate these debugger logs (and it obviously does not stay on production code).Note that, in the text of the breakpoint, you can use one of the special values
{lineNumber},{methodName},{className}or{threadName}, and you can also evaluate some code with the syntax{=xxx}. Just replace xxx with a variable name, or a method call, or whatever.