This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I am using NetBeans IDE (8.0.2) J2EE Version. Can't hit run() method of thread while debugging. It is showing the message in status bar as "Breakpoint hit at line15 by JavaApplicaion7 by Thread.MailThread"
Can you please explain in more details? There was a message "Breakpoint hit at line15..." thus did the application actually stop there? Do you see the appropriate stack trace in the Debugging view? Can you please check the breakpoint's properties, is the Suspend action set to suspend the breakpoint thread? Can you please post a full content of Output -> Debugger Console?
Or, is it possible for you to attach a sample application here with exact steps to reproduce?
package javaapplication7; /** * * @author sys6002 */ public class JavaApplication7 { /** * @param args the command line arguments */ public static void main(String[] args) { Mailthread1 mt1 = new Mailthread1(); Thread pt = new Thread(mt1); pt.setName("Mailthread"); pt.start(); } } package javaapplication7; /** * * @author sys6002 */ class Mailthread1 implements Runnable { public void run() { System.out.println("Hi"); System.out.println("Hi"); } }
I put breakpoints at the lines System.out.println("Hi"); System.out.println("Hi"); and from My main() method, I'm stepping into(F7) pt.start(); . Then that message is shown. But not actually moving to the breakpoints
It works for me. The breakpoint is hit when I add it on line with System.out.println("Hi"); You can not step into from pt.start(); to the run() method, because a new thread is started to execute the run() method. Thus if you add a breakpoint into run() method, it's hit by a different thread. Open Window -> Debugging -> Debugging and you'll see the threads there.
Now it is working by following your steps. But In my application, One class itself implements Runnable. And i cannot debug the run method of it. It will be like main() { initiliaize() } ======================== public void initialize() { try { if (bound) { try { Thread thredeven = new Thread(this); thredeven.setName("Mailthread"); thredeven.start(); } catch (Exception eintialize) { } } ==================== public void run() { System.out.println("Cannot reach this line while debugging"); }
I cant find the thread name in Threads window, and after thredeven.start() call, cursor is moving to the end of that block.