.jar problem

Started by
4 comments, last by nmi 17 years, 4 months ago
I've used the following tutorial to learn about programming with J2ME and now am trying to work out how to make .jar files: http://www.gamedev.net/reference/programming/features/j2me1/ the tutorial leaves me with 2 files: startup.java and startup.class which i then compile into a .jar archive using the jar.exe utility. This all works fine but when i try to install it to my sony k750i phone it just give me the error "operation failed". what am i doing wrong?
Advertisement
Probably because you didn't include a manifest.

You only need the .class file in the jar, by the way.

MIDlet packaging tutorial.

shmoove
OK, i've followed the tutorial and included the following manifest file:

MIDlet-Name: MyGame
MIDlet-Version: 1.0
MIDlet-Vendor: Martin
MIDlet-1: Startup
MIDlet-Jar-URL: MyGame.jar
MIDlet-Jar-Size: 100

and am still getting the same 'operation failed' error

any idea what i'm doing wrong now?
What does the directory structure in your jar look like ?
startup.class is in the root folder of the archive and the manifest file is in a folder called 'META-INF'
So the file "startup.java" contains a class "startup" (with little s) without any package ? Otherwise you have to create the appropriate subdirectories for the package and place the classfile there.

Also don't confuse the manifest with the application descriptor, for instance:
Listing 1: MIDlet-ManifestMIDlet-1: payment, payment.png, PaymentMIDletMIDlet-Name: paymentMIDlet-Vendor: Sun MicrosystemsMIDlet-Version: 1.0MicroEdition-Configuration: CLDC-1.0MicroEdition-Profile: MIDP-1.0Listing 2: Java Application Descriptor (Jad)MIDlet-Name: paymentMIDlet-Version: 1.0MIDlet-Vendor: Sun MicrosystemsMIDlet-Jar-URL: www.sun.comMIDlet-Jar-Size: 3521MIDlet-Data-Size: 513

(taken from here: http://www.linux-magazin.de/Artikel/ausgabe/2002/06/j2me/j2me.html?print=y)

The first one (manifest) must be put into the jar, the second one must be put into a text file ending in ".jad". The jad describes the jar, for instance the exact size of the jar (make sure that the size matches).

This topic is closed to new replies.

Advertisement