1

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
8
  • (1) download shinovon/KEmulator (github.com/shinovon/KEmulator/releases/download/v2.19.2/…) (2) run KEmulator (3) Menu: Midlet -> LoadJar... (4) Open your jar file. Commented Aug 25 at 7:31
  • 1
    Hello.jad : MIDlet-Jar-URL: hello.jar <--- but your jar command is Hello.jar. Commented Aug 25 at 10:33
  • @life888888 I installed many jars in my Nokia without JAD file. Commented Aug 25 at 11:35
  • (1) I don't have a Nokia N72. (2) I repeated your steps to generate hello.jar, and used shinovon/KEmulator to load hello.jar, and it worked fine. (3) I didn't use hello.jad. (4) But because your content mentioned Hello.jad, I specifically pointed out the capitalization issue. Commented Aug 25 at 12:11
  • 1
    Tested with shinovon/KEmulator, both Java 1.2 and Java 1.3 are supported. Commented Aug 25 at 13:55

1 Answer 1

0

The MANIFEST.MF was this:

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

But it should be like this:

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

The errors were in MIDlet-name (line 5), MIDlet-vendor (line 3) & MIDlet-version (line 6) in the MANIFEST.MF file.

The "name", "vendor" & "version" should start with capital letter.

"MIDlet-name -> MIDlet-Name"

"MIDlet-vendor -> MIDlet-Vendor"

"MIDlet-version -> MIDlet-Version"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.