j2me项目调试易出错1,startApp threw an Exception,java.lang.NullPointerException,
来源:互联网 发布:网络人远程控制官网 编辑:程序博客网 时间:2024/06/10 03:43
例如:netbeans开发工具中build.xml(debug) 中出现这样的错误:
startApp threw an Exception
java.lang.NullPointerException
java.lang.NullPointerException
at cn.edu.uestc.pandawireless.ui.WelcomeUI.scale(+1)
at cn.edu.uestc.pandawireless.ui.WelcomeUI.<init>(WelcomeUI.java:33)
at cn.edu.uestc.pandawireless.ui.UIControler.initUpdate(UIControler.java:78)
at cn.edu.uestc.pandawireless.LibMidlet.startApp(LibMidlet.java:71)
at javax.microedition.midlet.MIDletProxy.startApp(MIDletProxy.java:44)
at com.sun.midp.midlet.Scheduler.schedule(Scheduler.java:372)
at com.sun.midp.main.Main.runLocalClass(Main.java:461)
at com.sun.midp.main.Main.main(Main.java:126)
从提示中可以看出是在welcomeUI类的scale方法位置出错。原程序内容为:
private Image getImage(String path){
Image image = null;
//Image img = null;
try{
image = Image.createImage(path);
return image;
}catch (IOException e){
image = null;
return image;
}
}
这是因为image没有加载到图片(比如名称不对),为null造成java.lang.NullPointerException的错误。
解决方法就是加载正确的图片,或者在使用Image对象的时候判断是否非null,增加相应语句。
遇到具体问题可用根据提示分析问题解决问题!!!
- j2me项目调试易出错1,startApp threw an Exception,java.lang.NullPointerException,
- Servlet.service() for servlet jsp threw exception java.lang.NullPointerException
- Servlet.service() for servlet jsp threw exception java.lang.NullPointerException
- Servlet.service() for servlet jsp threw exception java.lang.NullPointerException
- threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with
- 严重: Servlet.service() for servlet jsp threw exception java.lang.NullPointerException at org.apache.
- 严重: Servlet.service() for servlet jsp threw exception java.lang.NullPointerException
- Could not create the view: An unexpected exception was thrown. java.lang.NullPointerException a
- Exception in thread "Timer-1" java.lang.NullPointerException
- SSH Exception 2017.3.26-1 java.lang.NullPointerException
- Unhandled Exception thrown: class java.lang.NullPointerException
- Exception starting filter struts2 java.lang.NullPointerException
- Exception in Thread "HouseKeeper" java.lang.NullPointerException
- Exception in thread "HouseKeeper" java.lang.NullPointerException
- Exception in thread "HouseKeeper" java.lang.NullPointerException
- Exception starting filter struts2 java.lang.NullPointerException
- Exception in thread "main" java.lang.NullPointerException
- Exception in thread "main" java.lang.NullPointerException
- use_link.cpp
- 关于WINXP中MP10无法升级到MP11的解决办法
- use_man.cpp
- use_max.c
- use_mem.cpp
- j2me项目调试易出错1,startApp threw an Exception,java.lang.NullPointerException,
- use_sbuf.cpp
- use_str.cpp
- use_swap.c
- utime.c
- 从硬盘安装linux系统
- u_intout.c
- vector1.cpp
- vector2.cpp