Jump to content
  • Advertisement
Sign in to follow this  
D3DXVECTOR3

Where 2 place files for J2ME Loading

This topic is 4960 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I dont know where 2 plac ethe files within my project directory so that the sprite data is beeing loaded when the app runs. I always get an IO error. Where do I need to put the files!? Also how can I make 1 build file so that when its dont I can upload 2 my phone!?

Share this post


Link to post
Share on other sites
Advertisement
Thanks for the quick reply :)
The app folder isnt there, im using Eclispe as IDE. The folder tree looks like this:


../<APP>/
......../.
......../Main.java
......../Canvas.java
......../Sprites/
................/Sprite.png
................/Player.png
......../Tiles/
................/Water.png
................/Wall.png

Share this post


Link to post
Share on other sites
Sorry for the delay, had classes to go to [depressed]. I personally have never tried using Eclipse for J2ME, but with your dir structure the code should be something like:

Image.createImage( "./Tiles/filename.png" );

or

Image.createImage( "./Sprite/filename.png" );

If youy could post your image loading code it might give a clue. you could also open up the JAR (You can use WinZip etc for this) that is created and make sure the images are being put in there by the compililation process.

--

Oh yeah, your other question!! J2ME requires two files usually a JAD and a JAR, these can both be uploaded to the phone in various way (Data Cable, Infrared, Bluetooth and OTA (Over The Air - WAP, GPRS etc).

If need to deploy the app to your phone OTA, just set up a websever (Apache or IIS both work). You need to edit the MIME types, but then you can download OTA from your own PC. You don't need a fast connection for this (I did it on a 9.6Kbps connection before!!).

Keep posting here if your still stuck, I'm assuming you're fairly new to J2ME stuff, and it can be confusing at first with all the quirks and other crap this API has!!

Share this post


Link to post
Share on other sites
A strange thing happend yesterday, well actually it isnt that strange at all but the code I have and the dir structure I was useing was correct after all. The problem was that I had made the changes in the files/folders in Windows Explorer. Eclipse caches the data into a "verified" folder and builds the midlet from there. So if you havent made any changes in the code or added folder 2 the project inside Eclipse it wont notice the files or changes in the folder.
The dir stucture remains the same as posed above and the code for loading the images looks like the one you posted Image.createImage( "/Sprite/filename.png" );

The project has a JAD file and it contains an netry for the JAR file like this: J2MEGame.jar, I have searched my HD for the file and I cant find it.

hihi yes im fairly new to J2ME, I have worked with Java be4 but it's been a few years now :p

Edit:

I think I have found it, Eclipse has an option under file > Export > JAR File and in here I can select the project and what and how I want 2 export it.

Well I got my JAR file but when I try 2 run it (by doule clicking the file) I get an error message : Failed to load Main-Class manifest attribute from J2MEGame.jar

Thanks for helping :)

[Edited by - D3DXVECTOR3 on March 9, 2005 2:00:11 AM]

Share this post


Link to post
Share on other sites
I fixed the main-class thing by building the jar via, right clicking the project and then select J2ME > Create Package. It then creates the jad and the jar file. Now when I double click the jad file the emulator is launched, but now I see the different classes 2 instead of running the midelt from the mainclass.

[Edited by - D3DXVECTOR3 on March 9, 2005 8:28:50 AM]

Share this post


Link to post
Share on other sites
In Eclipse you can rightclick on a project en you'll see an option J2ME > Create Package. This will build the jar file and place the jad in the same folder as the jar file.

When I run this build via the jad file it starts the Midlet with no error. The emulator is started and instead of running the midelt like it did in via Eclipse it shows a list of the classes in the jar file.


|----------------|
|----------------|
|MainMidlet |
|GameCanvas |
|AnotherClass |
|AnotherClassA |
|... |
|... |
| |
|----------------|




I can select any of these classes and it will try to run it. When selecting classes other then MainMidlet the midelt creates an exception, for obvious reasons.

Hope this cleares it up.

Share this post


Link to post
Share on other sites
You are ruuning in the emulator right? I reckon, but am not sure, it's compiling each class into individual midlets. Thats the only reason you would be presented with a list of separate classes that are all meant to be in the same application.

Share this post


Link to post
Share on other sites
Why is it compiling each class into individual midlets!? What did I forget something!?

Edit:

I have found out why. When I added the new classes I added them as midelts and then cleared the file and defined my own classes. Eclipse keeps an track on what and how and backs it up and uses that instead of checking what changes and what didnt.

Eclipse is one of the worst IDE tools I have ever used.
I HATE ECLIPISE!!!

[Edited by - D3DXVECTOR3 on March 14, 2005 7:20:14 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!