Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2012

    java.lang.Error: Static initializer

    I am developing application in j2me.In that i tried to create an object for another class but it show the error like" java.lang.Error: Static initializer: java/lang/NullPointerException".

    I tried like 1. TextBoxs textobj = TextBoxs.getInstance();

    2. TextBoxs textobj = new TextBoxs();

    the control does not enter into the TextBoxs class constructor.

  2. #2
    Nokia Developer Expert
    Join Date
    May 2012

    Re: java.lang.Error: Static initializer

    Hi ohiletechguy,

    as said in this thread
    The problem is not in this code.

    A NullPointerException is being thrown from a static initializer method in one of the classes.

    Static initializer code is either an assignment to a static variable at the point of declaration. For example:

    private static Object someObject = someMethod();

    Or, a block like this:

    static {
    // some code
    Any exception in code like this prevents the class from initializing, and results in an Error being thrown (and the class becoming unusable).

    A class is initialized the first time you create an instance of it, call one if it's static methods, or access one of it's static variables.


Similar Threads

  1. Replies: 3
    Last Post: 2011-03-25, 20:22
  2. About : java.lang.error/Java.lang.SecurityException:Cannot use exit(), use midlet. ..
    By sisu.hang in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2010-08-11, 05:48
  3. Debug problem: java/lang/NoClassDefFoundError: java/lang/Object
    By d-safety in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2009-11-23, 20:12
  4. java.lang.Error: ClassFormatError, java.lang.Class..unknown.()
    By kadro in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2007-08-23, 06:19
  5. Replies: 5
    Last Post: 2006-09-29, 02:05

Posting Permissions

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