-- 作者:bhchen
-- 发布时间:12/25/2008 3:49:00 PM
-- [求助]如何在J2ME程序中加载SVG,谢谢
加载SVG一般采用这种方式,但是我无论把我的svg文件放在哪里,都出现异常,异常内容如下: SVGImage svgImage = null; try{ InputStream imageStream = getClass().getResourceAsStream("E:/study/java_study/j2meTest/braveworld.svg"); svgImage = (SVGImage)SVGImage.createImage(imageStream, null); } catch(Exception e) { e.printStackTrace(); } Running with locale: Chinese_People's Republic of China.936 Running in the identified_third_party security domain java.lang.NullPointerException at com.sun.perseus.model.SVGImageImpl.createImage(+11) at javax.microedition.m2g.SVGImage.createImage(+5) at com.huawei.bhchen.MyM2GDemo.startApp(+17) 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(+80) java.lang.NullPointerException at com.huawei.bhchen.SVGImageCanvas2.paint(+43) at javax.microedition.lcdui.Canvas.callPaint(+85) at javax.microedition.lcdui.Display.repaint(+82) at javax.microedition.lcdui.Display.registerNewCurrent(+235) at javax.microedition.lcdui.Display.access$700(+6) at javax.microedition.lcdui.Display$DisplayAccessor.foregroundNotify(+46) at javax.microedition.lcdui.Display$DisplayManagerImpl.notifyWantsForeground(+152) at javax.microedition.lcdui.Display$DisplayManagerImpl.access$100(+6) at javax.microedition.lcdui.Display.setCurrent(+70) at com.huawei.bhchen.MyM2GDemo.startApp(+52) 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(+80) 请大侠看看为什么?
|