Invalid application

Hi guys,

I created a simple application in EclipseME for my mobile phone (a Sony Ericsson Z600):

package test;

import javax.microedition.midlet.*;

import javax.microedition.lcdui.*;

publicclass TestMidletextends MIDletimplements CommandListener{

private Command exitCommand;

private TextBox tbox;

public TestMidlet(){

exitCommand =new Command("Exit", Command.EXIT, 1);

tbox =new TextBox("Hello world MIDlet","Hello World!", 25, 0);

tbox.addCommand(exitCommand);

tbox.setCommandListener(this);

}

protectedvoid startApp(){

Display.getDisplay(this).setCurrent(tbox);

}

protectedvoid pauseApp(){}

protectedvoid destroyApp(boolean bool){}

publicvoid commandAction(Command cmd, Displayable disp){

if (cmd == exitCommand){

destroyApp(false);

notifyDestroyed();

}

}

}

I use the WTK1.0.4_02 and CLDC 1.0, package the files into a jad and a jar and try to transfer the app to my phone using bluetooth.

I right click my jar file in Windows and select "Send to -> Bluetooth device". The file is then successfully transferred to my phone but the phone then says 'invalid application'. after it has finished downloading. I also tried it with WTK2.2 and CLDC2.0 but that doesn't help. By the way I thought I found on the internet that the phone is only compatible with MIDP1.0 and CLDC1.0.

Anybody has any suggestions? Thanks a lot!

[2781 byte] By [chris_van_hinsbergena] at [2007-11-26 19:50:11]
# 1
can you show us your jad file ? did you compile the app MIPD 1 and CLDC 1?
suparenoa at 2007-7-9 22:39:27 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

OK that's weird. Here's the JAD-file:

MIDlet-1: TestMidlet,,test.TestMidlet

MIDlet-Jar-Size: 1224

MIDlet-Jar-URL: TestMidletSuite.jar

MIDlet-Name: TestMidletSuite Midlet Suite

MIDlet-Vendor: Midlet Suite Vendor

MIDlet-Version: 1.0.0

MicroEdition-Configuration: CLDC-1.1

MicroEdition-Profile: MIDP-2.0

So that's clearly wrong. Also, in the Manifest.mf:

Manifest-Version: 1.0

MicroEdition-Configuration: CLDC-1.1

MIDlet-Name: TestMidletSuite Midlet Suite

MIDlet-Vendor: Midlet Suite Vendor

MIDlet-1: TestMidlet,,test.TestMidlet

MIDlet-Version: 1.0.0

MicroEdition-Profile: MIDP-2.0

the MIDP and CLDC versions are wrong. BUT, in the project properties in EclipseME, I have selected at J2ME --> Device Group -> "J2ME Wireless Toolkit 1.0.4_02". It doesn't matter which device I select, it always sets MIDP and CLDC to 2.0 and 1.1 respectively, even though the selected Device (in Device Management) is stated to be configured with CLDC-1.0 and MIDP-1.0.

Changing just the version numbers in manifest.mf or jad file doesn't help.

Message was edited by:

chris_van_hinsbergen

chris_van_hinsbergena at 2007-7-9 22:39:27 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3
it is strange because, if you edit the jad file in eclipse, you CAN change settings for compiling...so, try:1 - edit jad with eclipse and choose MIDP 1.0 and CLDC 1.0.2 - compile with java 1.3 compliance
suparenoa at 2007-7-9 22:39:27 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4

OK I fixed it, by:

1) using WTK2.2, but create a new device, add under 'libraries' the cldcapi10.jar and midpapi10.jar from the WTK22\lib directory and delete the old CLDC and MIDP libraries. These steps are described here: http://eclipseme.org/docs/advDeviceMgmt.html#midp10example.

2) I deleted the old project completely and started all over. Using the old project I wasn't able to package it correctly, no matter what. By the way, I only send the jar file to the phone.

chris_van_hinsbergena at 2007-7-9 22:39:27 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5
Ah supareno, that's what I was looking for. Just double click the jad file in Eclipse, and then you can select which api's to use. Thanks :)
chris_van_hinsbergena at 2007-7-9 22:39:27 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 6
you're welcome
suparenoa at 2007-7-9 22:39:27 > top of Java-index,Java Mobility Forums,Java ME Technologies...