Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor nagesh.chetana's Avatar
    Join Date
    Jul 2008
    Posts
    148
    Hi,

    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 Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,672
    if it is happening in the emulator, you could always try debugging it line-by-line..

  3. #3
    Super Contributor grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    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.

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

    Code:
    public void startApp();
      LineNumberTable:
       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
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Hi,
    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,
    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 C++
    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 C++
    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
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved