This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java Micro Edition and the fly likes null point exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "null point exception" Watch "null point exception" New topic
Author

null point exception

Anu sunny
Greenhorn

Joined: Oct 21, 2013
Posts: 2
hello sir,
Iam new to j2me so recently i wrote a program on image in that i got a" null point exception" and image did not display. my img in the src folder is that correct? Please help me.

Error is:
Project "img" loaded
Project settings saved
Building "img"
Build complete
Running with storage root DefaultColorPhone
startApp threw an Exception
java.lang.NullPointerException
java.lang.NullPointerException
at javax.microedition.lcdui.Form.append(+11)
at ImageTutorial.startApp(+45)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+270)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+116)
Execution completed.
735550 bytecodes executed
27 thread switches
741 classes in the system (including system classes)
3893 dynamic objects allocated (111700 bytes)
2 garbage collections (93492 bytes collected)

Code is:
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10268
    
    8

Welcome to the Ranch.


Do you see anything wrong on line 4 of the above code snippet?

Also please check your Purple Mooseages for an important administrative matter


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Stuart A. Burkett
Ranch Hand

Joined: May 30, 2012
Posts: 679
Anu sss wrote:

Never do this. A catch block should not be empty. You should have at least a comment as to why you left it empty (there are occassionally good reasons for this). If you don't have a good reason, then you should at least print out the stack trace.
Anu sunny
Greenhorn

Joined: Oct 21, 2013
Posts: 2
sir,
i wrote the code in catch block like "e.PrintTrace();" as you told before but, same exception error occured. so please help me
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41597
    
  55
Re-read Maneesh's post carefully, paying close attention to each line of code.


Ping & DNS - my free Android networking tools app
 
Don't get me started about those stupid light bulbs.
 
subject: null point exception