j2me Nokia help

Started by
6 comments, last by Durath 19 years, 10 months ago
Hi all. I''m trying to make a simple game for nokia 60 series, and i''m using th tutoria/article on this website. (http://www.gamedev.net/reference/articles/article1949.asp) I''m usin notepad to write the code, J2ME Wireless Toolkit to compile/package, and Nokia Developper''s Suite for the nokia 60 series emulator. the game is very simple: a hidden image is covered in black, and you move your X around the screen and use the ''fire'' button to start/stop making a box to uncover. if you get hit by the enemy while making a box, you lose a life, and when you close the box, the hidden picture under is revealed. im loading a few images, an i get a java.io.IOexception coming from the following code: secret = Image.createImage("/secret.png"); player = Image.createImage("/player.png"); logo = Image.createImage("/logo.png"); red = Image.createImage("/red.png"); blue = Image.createImage("/blue.png"); lose = Image.createImage("/lose.png"); where they are declared as : Image logo, player, red, blue, lose, secret; earlier in the code. is there something else to put in or something? any help is appreciated. also, i there a way i can attach my .java files on this forum?
Advertisement
Where are you image files?

They have to be in the /res folder...

ciao,
dw
http://www.mondonerd.com -> The home of The ISOJ2ME Project (a J2ME rpg game engine) and other cool softwares...
No they don''t; they have to be in the folder specified in the createImage() call. Which in this case is the JAR root.

Make sure the images actually are in your JAR. You can open it with WinRAR or other such tools; it''s basically a glorified zip file.
quote:Original post by Zahlman
No they don''t; they have to be in the folder specified in the createImage() call. Which in this case is the JAR root.

Make sure the images actually are in your JAR. You can open it with WinRAR or other such tools; it''s basically a glorified zip file.


This is true to an extent. In the case of the application being already packed in a .jar file and running on the device, then this is true. However, when debugging/testing your application in the WTK the WTK will require the images to exist in its internal /res folder of the current project. Unless of course you are creating a package, then running the jar itself with an emulator.
-----------------------------Final Frontier Trader
Aha, that explains why people bother with it then. I don''t personally use the WTK, I''m doing all my packaging in Sun ONE Studio. It makes my system (128 mb ram and all) cry, but at least I can figure out how to make it do what I want. :s
sometimes if your graphic is too big or too small, also easy to arose this problem!
so i should open the jar file and change where the images are placed? omw to try that now
quote:Original post by Durath
so i should open the jar file and change where the images are placed? omw to try that now


Or just check out what path they''re saved under and change the path in your code to match that. Since when you rebuild the application they''ll probably get saved in the same place and you don''t want to manually move the pictures every time.

shmoove

This topic is closed to new replies.

Advertisement