I was making a J2ME MIDlet application. I wrote the code, compiled it to Java 1.2 bytecode, prevrified it and then packed it into jar. But when I sent it to my Nokia N72, it said: Unable to install. Invalid file.
I tried to make jar archive with zip but again it didn't work. These are my manifest and jad file, but I think they don't have problems.
Hello.jad
MIDlet-1: Hello!, icon.png, Hello
MIDlet-Jar-Size: 1932
MIDlet-Jar-URL: Hello.jar
MIDlet-Name: Hello!
MIDlet-Vendor: Mehrzad
MIDlet-Version: 1.1
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0`
MANIFEST.MF
Manifest-Version: 1.0
MIDlet-1: Hello!, icon.png, Hello
MIDlet-vendor: Mehrzad
MicroEdition-Configuration: CLDC-1.1
MIDlet-name: Hello!
MIDlet-version: 1.1
Created-By: 1.8.0_381 (Oracle Corporation)
Nokia-MIDlet-Category: Application
MicroEdition-Profile: MIDP-2.0`
This is my code (Hello.java):
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class Hello extends MIDlet {
private Form form;
private Display display;
public Hello() {
form = new Form("Hello, World!");
form.append("Powered by JavaME");
}
public void startApp() {
display = Display.getDisplay(this);
display.setCurrent(form);
}
public void pauseApp() { }
public void destroyApp(boolean uncoditional) { }
}
I used these commands for compile, prevrify & making JAR:
javac -source 1.2 -target 1.2 -classpath /path/to/midpapi20.jar Hello.java
preverify1.1 -classpath /path/to/midpapi20.jar:/path/to/rt.jar Hello -d output
mv icon.png output
cd output
jar -cvf Hello.jar Hello.class icon.png
jar -ufm Hello.jar MANIFEST.MF
Midlet->LoadJar...(4) Open your jar file.MIDlet-Jar-URL: hello.jar<--- but your jar command isHello.jar.