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

## 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 on other sites
usually in the res driectory.

eg:

/WTK21/apps/[Project Name]/res/

##### Share on other sites
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 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 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 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 on other sites
I'm not quite sure what you mean exactly by the above, can you clarify.

##### 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 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 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 on other sites
Quote:
 Original post by D3DXVECTOR3Eclipse is one of the worst IDE tools I have ever used.I HATE ECLIPISE!!!

I use VS.NET combined with WTK21. It works a treat!

##### Share on other sites
^^ Wait a sec... you are using Visual Studio .NET for developing J2ME Midlets!?
If so then how and does it have a Wizard 2 create a blank midlet!?

##### Share on other sites
Quote:
 Original post by D3DXVECTOR3Eclipse is one of the worst IDE tools I have ever used.I HATE ECLIPISE!!!

That is probably because you don't know how to use it (let alone spell it).

You are obviously a GUI junkie who gets off on fancy wizards rather than productive tools. Eclipse is a really good tool for programmers. Its advanced features beat anything else I've ever seen (yes, that includes all versions of VS.NET I've seen (although I've not had a play with the 2005 ver yet)).

True some of the config options are confusing, but they don't affect productivity because you don't have to use them very often.

Ultimately when you realise how good the code completion, refactoring etc, are, you will learn to like it.

Mark

##### Share on other sites
Quote:
 Original post by D3DXVECTOR3^^ Wait a sec... you are using Visual Studio .NET for developing J2ME Midlets!?If so then how and does it have a Wizard 2 create a blank midlet!?

I don't. I use KToolbar (part of the WTK21) to create and compile projects. I just VS.NET to edit the .java files.

##### Share on other sites
Vim is good for editing JAVA files, if you want to go on a tight memory footprint.

##### Share on other sites
Eclipse is awesome full stop.

I use it for professional J2EE development using MyEclipse with JBoss application server plug-in.

Markr is correct, D3DXVECTOR3 is probably use to using pink ware, this is something us professional software developers call IDE's like .NET.

Sorry for this reply, but I do hate it when people critisise something they can't use properly.

Regards,
Steve

##### Share on other sites

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

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628732
• Total Posts
2984436

• 25
• 11
• 10
• 16
• 14