🔒 Locked
Strange error
Advertisement
Original Post
I don't know if this is the right forum for this, but . . . I'm a C programmer who recently decided to try out the J2ME side of things. I hardly know Java or these libraries, and there's this bit of code that keeps turning up a problem. I'd been consulting the Wells book on J2ME game programming and used that code as a reference but couldn't see where my problem lay. Google didn't help either. So I'm asking someone here. The compiler keeps turning up a simple "error verifying class" The code causing the problems is public void run(){ StartTime = System.currentTimeMillis(); renderer.repaint(); //SNIP Timelapsed = System.currentTimeMillis() - StartTime; //The line below is the one that turns up the error if(Timelapsed < 20){ try{Thread.sleep(20-Timelapsed);} catch(java.lang.InterruptedException e){} } } //starttime and timelapsed are longs
Hi!
Are you preverifying against the right MIDP-version ?
Mixing MIDP1 und MIDP2 libs can cause these problems.
McMc
Are you preverifying against the right MIDP-version ?
Mixing MIDP1 und MIDP2 libs can cause these problems.
McMc
No, I'm pretty sure I'm using MIDP 1
this line if(Timelapsed <= 20){
and a while(running) loop within
this class alone
class Renderer extends Canvas implements Runnable
cause the problem
i don't know if that helps
EDIT : I'm going to just code these things outside that class, but nonetheless I'm curious as to why it does not work within it
this line if(Timelapsed <= 20){
and a while(running) loop within
this class alone
class Renderer extends Canvas implements Runnable
cause the problem
i don't know if that helps
EDIT : I'm going to just code these things outside that class, but nonetheless I'm curious as to why it does not work within it
Quote:
The compiler keeps turning up a simple "error verifying class"
what compiler are you using? are you developing with an ide (jbuilder, jcreator, eclipse)? what j2me sdk are you using? the default one from sun or a custom one from a nokia-sonyericsson-whatever?
(it happened to me with sonyericsson sdk and jbuilder9 that compiling would result in an "error preverifing class")
Well, I decided it was time to change tools today to NetBeans IDE 4.0 today for various reasons, and everything much better now . . . except I get a nullpointer exception when i try to reference the image files in my application
eg : SplashScreen = Image.createImage("/splash.png");
when my renderer draws the splash screen for instance, it returns this :
java.lang.NullPointerException:
at Doggystyle$Renderer.SplashScreen(+18)
at Doggystyle.RunGame(+19)
at Doggystyle.NewGame(+102)
at Doggystyle$Renderer.paint(+19)
at javax.microedition.lcdui.Canvas.callPaint(+80)
at javax.microedition.lcdui.Display.repaint(+77)
at javax.microedition.lcdui.Display$DisplayAccessor.repaint(+14)
at javax.microedition.lcdui.Display$DisplayManagerImpl.repaint(+16)
at com.sun.midp.lcdui.DefaultEventHandler.repaintScreenEvent(+24)
at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+774)
Now, when I ported to netbeans I didn't change the code around at all, and the file's made its way into the jar file, so being the j2me/java newbie I am, I'm not sure what the problem is. However, I'm going to assume I don't have NetBeans set up properly to run my application. Is there some kind of application setting or parameter I'm missing out on? Any help you can give would be appreciated, so I can get the phone version of our nifty little sidescroller done instead of just a pc version.
eg : SplashScreen = Image.createImage("/splash.png");
when my renderer draws the splash screen for instance, it returns this :
java.lang.NullPointerException:
at Doggystyle$Renderer.SplashScreen(+18)
at Doggystyle.RunGame(+19)
at Doggystyle.NewGame(+102)
at Doggystyle$Renderer.paint(+19)
at javax.microedition.lcdui.Canvas.callPaint(+80)
at javax.microedition.lcdui.Display.repaint(+77)
at javax.microedition.lcdui.Display$DisplayAccessor.repaint(+14)
at javax.microedition.lcdui.Display$DisplayManagerImpl.repaint(+16)
at com.sun.midp.lcdui.DefaultEventHandler.repaintScreenEvent(+24)
at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+774)
Now, when I ported to netbeans I didn't change the code around at all, and the file's made its way into the jar file, so being the j2me/java newbie I am, I'm not sure what the problem is. However, I'm going to assume I don't have NetBeans set up properly to run my application. Is there some kind of application setting or parameter I'm missing out on? Any help you can give would be appreciated, so I can get the phone version of our nifty little sidescroller done instead of just a pc version.
First, manually verify the JAR contents (open it with WinRAR or something like that, and check that the appropriate .PNG is there, in the root directory).
Also make sure that the JAD references the correct JAR file (the JAD is plain-text and pretty easy to understand, so just check that everything looks logical).
If that checks out ok then you may well have a problem in the NetBeans configuration, yes.
Also make sure that the JAD references the correct JAR file (the JAD is plain-text and pretty easy to understand, so just check that everything looks logical).
If that checks out ok then you may well have a problem in the NetBeans configuration, yes.
Thanks for your replies. However . . . I'm doing everything right and it's flat out not working. The file is even in the JAR. It's not able to load the image nonetheless. I can even use it as the MIDlet icon, but I can't access it from the MIDlet itself. Anyone have any advice besides "tough shit"?
EDIT : I decided to make my JADs and JARs by hand, using my old files with the command prompt and just give NETBEANS the finger. It works now. Thanks for your help.
[Edited by - Al Gorithm on February 10, 2005 3:32:29 PM]
EDIT : I decided to make my JADs and JARs by hand, using my old files with the command prompt and just give NETBEANS the finger. It works now. Thanks for your help.
[Edited by - Al Gorithm on February 10, 2005 3:32:29 PM]
EDIT : Never mind. Been staring at it for too long :)
[Edited by - Al Gorithm on February 10, 2005 6:24:05 PM]
[Edited by - Al Gorithm on February 10, 2005 6:24:05 PM]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement