I am debugging a Java Application in NetBeans IDE 8.0.2.
When a Thread.start()
method is called I am not able to reach the run()
method of that thread (though I put the breakpoints in that method).
However, sometimes it is hitting the method but sometimes not.
How can I reach the run()
method while debugging?
public class JavaApplication7 {
public static void main(String[] args) {
Mailthread1 mt1 = new Mailthread1();
Thread pt = new Thread(mt1);
pt.setName("Mailthread");
pt.start();
}
}
And the Thread class is :
class Mailthread1 implements Runnable {
public void run() {
System.out.println("Cant hit this line");
}
}
in the JDWP, there are 3 types of breakpoint: class, method and line.
If your IDE fails to intercept the line breakpoint in the println(), then you can try a method breakpoint on the run() reclaration.
If that fails, there is something out of sync between the byte code and the source. You can try adding lines, breakpointing another line above and below.
Other than that, change IDE and/or change JVM. This should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With