Wireless Tool Kit

I have a game that works in the wireless tool kit but when i run it OTA in the wireless tool kit it doesnt work. The music works but no Images is shown, a error message in the wireless toolkit " java/Lang/ null pointer exception" I dont understand what is wrong when it works when it is run without the ota. Regards Mick

probably doesnt work in the WTK dude- try it on a real phone. how does it do there?

Havent tried it on a real phone. new to this so i havent learned how to instal to phones yet. Just strange that it work on wtk on ordinary run but not in ota in wtk

Some more info would be great.

The WTK is one of the best emulators out there (even if it has that stupid top bar crap).

  • what do you mean by ‘ota’? What are you doing ‘ota’?
  • where do you get your images from? jar or also ota?
  • where do you get that null pointer from? Track it down!

ps: when you start the wtk, do it from dos. then all system.out.printlns will be written to the console. Ah the wonderful world of j2me debugging.

In wtk ota is a option for testing, over-the-air. The game is getting installed to the emulator when it is run through ota. The error message is uncaugth exception, nullPointer. Cant track it down cause it doesnt give any information in what class or anything.

Ah ok. Was just that OTA is a often used in other contexts.

Have you checked the Jad File?

NullPointer:
That is the problem with j2ME.
How far do you get with the installation? Does the app start?
Put some sysouts into the entry points: main class constructor and startapp.

Can it be that i have to many actor objects to paint out to the screen, I have about 50 enemies on the first level. Maybe I should make different threads for collisionstest and all other tests?

Have you done what I wrote? Have you checked how far you get?

Oh sure that could be, are they requesting repaints? If so remove that. Have only one place where you render.
Double-buffering would help.

More threads won’t help. Actually they will hurt more because your actual device will have a limited processor and you can only go so far.
The sync time will kill your app.

If anything, remove threads. Get everything into one rendering and update loop. (if it is turn based, then you can have a thread do the update cycle so your main thread can continue rendering, but only for TBS games, because the player can wait).

50 enemies is a lot. Look into collision optimisations like BSPs or quad trees.

The apply does start. The backgrond color is painted on the screen but not the images and sound. I do not request repaint(). There is a automatic paint in the end of the loop, the repaint is controlled by the loop time sequence. I will look into doubble buffering and quadTree. But when it comes to collision, painting and other actions I have made it to be unactive until the player is close to the so all actors and collision testing does not happen.

I have been using flushGraphics if that is what you mean double buffer. Maybe there is better way to do double buffer?

Ah so it does get far enough.

Can you disable sound/images and see if that helps?

flushGraphics is ok. GameCanvas has a double buffer on the inside.

In the end it could just be a WTK problem and will never happen on the end devices.
Though it is still good to have safeguards in your code so when other devices start bitching, you can at least eliminate those parts as possible wrong-doers.

BTW: Is this project intended to be ported to other devices or just a college project?
If the former, you might want to look into using a preprocessor.
I used to have try-catches wrapping the content code of each method that was only added on demand (otherwise it would really slow down the app). This helped track down those wierd bugs.

One possibility:

When running from the file system (under windows), accessing resources is case insensitive.
As soon as you deploy the build to a jar, it becomes case sensitive.

I’d suggest you check all your resource names for correct case.

Beyond that, stop using the WTK in its stand-alone configuration.
I suggest (atleast to begin with) you change over to Eclipse, with the EclipseME plugin - it is a much more productive working enviroment.

I will try to install the game on a real phone and see if it works. And after that I will look deeper into the code. It might be a install problem. The game is a hobby project that is intended to be published for downloading to phones.

Try to catch Throwable on every thread, and print stack trace on the catch clause.


Javatech
java games