Hi
I am total beginner and your lessons out there are really wonderful.
currently I am going through "using debugger lesson 2".
I am using the same debugger tutorial file.
I have put the break point at line number 158 (mylibrary class - main)
158 public static void main(String args) {
159 // create a new mylibrary
160 MyLibrary testLibrary = new MyLibrary("Test Drive Library");
161 Book b1 = new Book("War and Peace");
b1.setAuthor("Tolstoy");
Book b2 = new Book("Great Expectations");
b2.setAuthor("Charles Dickens");
let me come to the problem I am facing,
when I press step over, it is not going to line number 161.
It goes to line number 111 if (aBook.getPerson().getName(). and throws some error and the program terminates
thanks in advance for your hep
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
few more details.
I think the problem is because of not handling the null-pointer exception.
when I run MyLibrary class,I get
Exception in thread "main" java.lang.NullPointerException
at org.debugger.tutorial.MyLibrary.getBooksForPerson(MyLibrary.java:111)
at org.debugger.tutorial.MyLibrary.printStatus(MyLibrary.java:202)
at org.debugger.tutorial.MyLibrary.main(MyLibrary.java:177)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Line 160 is executing the constructor for the MyLibrary class. If there is an error in this method, the debugger can't get to line 161. So you evidently have an error in your code. I would double-check that you imported the code correctly. Good luck. Mark
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Mark
Thanks for your quick replay.I corrected the code.You are talking about the same null pointer exception at line no.111 on chapter 4.Its fine. But I am facing another problem on debugging and it is getting terminated.Can you please advise me on this.
Hi
I am total beginner and your lessons out there are really wonderful.
currently I am going through "using debugger lesson 2".
I am using the same debugger tutorial file.
I have put the break point at line number 158 (mylibrary class - main)
158 public static void main(String args) {
159 // create a new mylibrary
160 MyLibrary testLibrary = new MyLibrary("Test Drive Library");
161 Book b1 = new Book("War and Peace");
b1.setAuthor("Tolstoy");
Book b2 = new Book("Great Expectations");
b2.setAuthor("Charles Dickens");
let me come to the problem I am facing,
when I press step over, it is not going to line number 161.
It goes to line number 111 if (aBook.getPerson().getName(). and throws some error and the program terminates
thanks in advance for your hep
few more details.
I think the problem is because of not handling the null-pointer exception.
when I run MyLibrary class,I get
Exception in thread "main" java.lang.NullPointerException
at org.debugger.tutorial.MyLibrary.getBooksForPerson(MyLibrary.java:111)
at org.debugger.tutorial.MyLibrary.printStatus(MyLibrary.java:202)
at org.debugger.tutorial.MyLibrary.main(MyLibrary.java:177)
I am struck.Please someone help me
Line 160 is executing the constructor for the MyLibrary class. If there is an error in this method, the debugger can't get to line 161. So you evidently have an error in your code. I would double-check that you imported the code correctly. Good luck. Mark
Hi Mark
Thanks for your quick replay.I corrected the code.You are talking about the same null pointer exception at line no.111 on chapter 4.Its fine. But I am facing another problem on debugging and it is getting terminated.Can you please advise me on this.
**<terminated, exit value: 0>C:\Program Files\Java\jre6\bin\javaw.exe (Mar 17, 2011 2:58:52 PM) **
after setting the breakpoint at my main(MyLibrary class), when I am trying to debug my program , it is getting terminated with the following messages
org.debugger.tutorial.MyLibrary at localhost:49286
Thread (Suspended (entry into method main in MyLibrary))
MyLibrary.main(String) line: 163
<terminated, exit value: 0>C:\Program Files\Java\jre6\bin\javaw.exe (Mar 17, 2011 2:58:52 PM)