Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Jul 2008

    Getting to know the line number where exception occurs


    I'm trying to run a program but its throwing me Null Pointer Exceptions.

    I'm not able to locate the exceptions,
    at Example.<init>(+177)
    at Demo.drafts(+13)

    how can i get to know the line number where the exception is happening?
    Is there any other way than using System.out.println statements?

    Please help me.Its urgent.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003

    Re: Getting to know the line number where exception occurs

    if it is happening in the emulator, you could always try debugging it line-by-line..

  3. #3
    Super Contributor
    Join Date
    Jun 2003
    Cheshire, UK

    Re: Getting to know the line number where exception occurs

    If you compiled your class with debugging information (use the -g option), then the line number table is in each class.

    You can view the line number table using javap, which is part of the JDK.

    javap -l classname
    The output lists each method, something like:

    public void startApp();
       line 10: 0
       line 12: 5
       line 14: 18
       line 15: 30
       line 17: 37
       line 19: 45
       line 20: 50
    For each line number, the bytecode offset where that line starts is given.

    An exception can be thrown from any bytecode instruction in that line. For example, in the output above, an exception from any offset from +30 to +36 is from line 15 in the original source code.

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    The Capital of INDIA

    Thumbs up Re: Getting to know the line number where exception occurs

    Well,Thats the best way,what is suggested by symbianyucca's Avatar
    symbianyucca..however if you have to check the small size of code (if you know in which area exception can occur) in order to save the time you can put the system.out.println()'s and check the same..

    Also you can check according to the exception type..like if the exception is coming due to loading the image then it may be IOException,Null...and so on..

    This is how you can move ahead..
    Thanks with Regards,

    R a j - The K e r n e l

    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. STL error
    By mdzahidul_haque in forum Symbian
    Replies: 2
    Last Post: 2008-12-05, 12:24
  2. carbide and v2.0 SDK's helloworldbasic?
    By pollyp in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2007-10-02, 00:49
  3. Replies: 3
    Last Post: 2007-01-18, 11:27
  4. Get line number from CEikEdwin
    By nimbus_cloud in forum Symbian
    Replies: 1
    Last Post: 2005-11-25, 03:15
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts