×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    26

    Uncaught exception java/lang/Error: Static initializer: java/lang/NullPointerExceptio

    Hello Guys,

    When I m trying to launch my applicaion on emulator I m getting following Error

    Uncaught exception java/lang/Error: Static initializer: java/lang/NullPointerException.

    my app is even not able to start, what would be the reason behind this and what is the solution.
    thanks

    regards
    sharma_durg

  2. #2
    Registered User
    Join Date
    Aug 2006
    Posts
    4

    Re: Uncaught exception java/lang/Error: Static initializer: java/lang/NullPointerExce

    hi

    the problem will be in the startApp method can u post the code of that particular method.


    Nuwan Nanayakkara

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    7

    Re: Uncaught exception java/lang/Error: Static initializer: java/lang/NullPointerExce

    Hi NS,
    I am having the same problem with sharma. I am using LWUIT 1.4 and I am getting that same error. I was using LWUIT 1.3 and was doing just fine but upon changing the resource jar from 1.3 to 1.4, it gives me that error and refuses to load my app in emulator.
    If the StartApp was working well with LWUIT 1.3 why should there be a problem now?
    Please help. My StartApp Code and the class/fxn it calls are below:

    public void startApp() {
    //init the LWUIT Display
    Display.init(this);
    // Set the application theme here
    try {
    r = Resources.open("/LWUITtheme.res");
    UIManager.getInstance().setThemeProps(
    r.getTheme(r.getThemeResourceNames()[0]));
    startMain();


    }
    catch (Throwable ex) {
    ex.printStackTrace();
    Dialog.show("Exception", ex.getMessage(), "OK", null);
    }

    }

    public void startMain(){//units = "0";senderid="";smsuid=""; System.out.println("k has value of "+k+" right now");
    //form main starts. 1. Create a Form
    mainForm = new Form("Communic8");
    // 2. Set LayoutManager
    mainForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
    //4. add the buttons that will go from home page
    iEduc = r.getImage("xschool");
    xschool = new Button(" XTRASchool",iEduc);
    xschool.addActionListener(eti);
    iMsg = r.getImage("xmessaging");
    xmessaging = new Button(" XTRAMessaging",iMsg);
    xmessaging.addActionListener(eti);
    iCtt = r.getImage("content");
    xcontent = new Button(" XTRAContent",iCtt); //xcontent.setAlignment(Label.CENTER);
    xcontent.addActionListener(eti);iUti = r.getImage("utilities");
    xutil = new Button(" XTRAUtility",iUti);xutil.addActionListener(eti);
    //add buttons to the form
    mainForm.addComponent(xschool);mainForm.addComponent(xmessaging);
    mainForm.addComponent(xcontent);mainForm.addComponent(xutil);
    //choose the one to be on focus
    mainForm.setFocused(xschool);//5. add the softkey command
    //Is having menu commands for each one here necessary? mainForm.addCommand(checkrespage);
    mainForm.addCommand(exitCommand);// 6. Show it
    mainForm.show();//form main ends
    }
    Thanks for your help
    Quote Originally Posted by ns_nanayakkara View Post
    hi

    the problem will be in the startApp method can u post the code of that particular method.


    Nuwan Nanayakkara

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Uncaught exception java/lang/Error: Static initializer: java/lang/NullPointerExce

    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:

    Code:
    private static Object someObject = someMethod();
    Or, a block like this:

    Code:
    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.

    Graham.

Similar Threads

  1. VS.Net 2003 Carbide 2.01 and epoc32.exe
    By ValentinK in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2007-01-12, 12:31
  2. First-chance exception in emulator S60 3rd ed.
    By darioses in forum Symbian Tools & SDKs
    Replies: 6
    Last Post: 2006-04-25, 18:24
  3. Catching an exception
    By btnokdev in forum Mobile Java General
    Replies: 2
    Last Post: 2003-10-11, 14:45
  4. 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
  •