Running J2ME applications

I have written a simple MIDlet for J2ME. But when I run it using IDEA5.0 the default emulator that it starts does not show my application in the list. It says 'Select one to launch:' but there are no applications listed. What could be wrong?

Here is my .jad file and .java:
MIDlet-Jar-Size: 1153507
MIDlet-Jar-URL: TestJ2me.jar
MIDlet-Name: TestJ2me
MIDlet-Vendor: vsp
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0

Java code:
package com.vsp.testj2me;

import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
//import javax.microedition.midlet.*;

public class TestJ2me extends MIDlet implements CommandListener
{
private Form mMainForm;

public TestJ2me()
{
mMainForm = new Form( "com.vsp.testj2me.TestJ2me" );
mMainForm.append( new StringItem( null, "Hello, MIDP!" ) );
mMainForm.addCommand( new Command( "Exit", Command.EXIT, 0 ) );
mMainForm.setCommandListener( this );
}

public void startApp()
{
Display.getDisplay( this ).setCurrent( mMainForm );
}

public void pauseApp()
{
}

public void destroyApp( boolean unconditional )
{
}

public void commandAction( Command c, Displayable s )
{
notifyDestroyed();
}
}

Vijay

3 comments

Hello Vijay,

Midlet-1 property is missed. It is the name of your target midlet where MIDlet-Name
is a name for a whole suite.

Thank you.

-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

I have written a simple MIDlet for J2ME. But when I run it using
IDEA5.0 the default emulator that it starts does not show my
application in the list. It says 'Select one to launch:' but there are
no applications listed. What could be wrong?

Here is my .jad file and .java:
MIDlet-Jar-Size: 1153507
MIDlet-Jar-URL: TestJ2me.jar
MIDlet-Name: TestJ2me
MIDlet-Vendor: vsp
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0
Java code:
package com.vsp.testj2me;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
//import javax.microedition.midlet.*;
public class TestJ2me extends MIDlet implements CommandListener
{
private Form mMainForm;
public TestJ2me()
{
mMainForm = new Form( "com.vsp.testj2me.TestJ2me" );
mMainForm.append( new StringItem( null, "Hello, MIDP!" ) );
mMainForm.addCommand( new Command( "Exit", Command.EXIT, 0 )
);
mMainForm.setCommandListener( this );
}
public void startApp()
{
Display.getDisplay( this ).setCurrent( mMainForm );
}
public void pauseApp()
{
}
public void destroyApp( boolean unconditional )
{
}
public void commandAction( Command c, Displayable s )
{
notifyDestroyed();
}
}
Vijay



0

Thx for pointing out. That really helped! But now I'm getting the following and the emulator dies:

C:\WTK22\bin\emulator -classpath C:\WTK22\lib\midpapi20.jar;C:\WTK22\lib\cldcapi11.jar;C:\WTK22\lib\wma20.jar;C:\WTK22\lib\mmapi.jar;C:\WTK22\lib\j2me-ws.jar;C:\WTK22\lib\jsr75.jar;C:\WTK22\lib\jsr082.jar;C:\WTK22\lib\jsr184.jar;C:\prgs\TestJ2me\TestJ2me.jar -Xdescriptor:C:\prgs\TestJ2me\TestJ2me.jad -Xdevice:DefaultGrayPhone
Running with storage root DefaultGrayPhone
Method............: 1016db58 'com/sun/midp/midlet/MIDletState.createMIDlet (static)'
Stack Chunk.......: f11010
Frame Pointer.....: f11068
Current IP........: 101f1715 = 101f1707 + offset 14
Previous Frame....: f11030
Previous IP.......: 10214d75 (offset 22)
Frame size........: 7 (1 arguments, 6 local variables)
Argument[0].......: f11ed4
Local[1]..........: 0
Local[2]..........: f11030
Local[3]..........: f284d0
Local[4]..........: f11044
Local[5]..........: 1015a478
Local[6]..........: f11010
Operand[1]........: f11ed4

Method............: 10184618 'com/sun/midp/midlet/Selector.run (virtual)'
Stack Chunk.......: f11010
Frame Pointer.....: f11030
Current IP........: 10214d75 = 10214d5f + offset 22
Previous Frame....: 0
Previous IP.......: 1
Frame size........: 6 (1 arguments, 5 local variables)
Argument[0].......: f12114
Local[1]..........: f28690
Local[2]..........: f11ed4
Local[3]..........: 0
Local[4]..........: 0
Local[5]..........: 0
Operand[1]........: f28690

VM status:
Instruction pointer.: 101f1715 (offset within invoking method: 14)
Next instruction....: 0x4c
Frame pointer.......: f11068
Local pointer.......: f1104c
Stack size..........: 128; sp: f11080; ranges: f11018-f11218;
Contents of the current stack frame:
f1104c: f11ed4 (lp)
f11050: 0
f11054: f11030
f11058: f284d0
f1105c: f11044
f11060: 1015a478
f11064: f11010
f11068: f11030 (fp)
f1106c: 10214d75
f11070: f11048
f11074: 1016db58
f11078: f11010
f1107c: 0 (end of frame)
f11080: f11ed4 (sp)
Execution stack contains 108 items:
f12114
f28690
f11ed4
0
0
0
0
1
f11014
10184618
f11010
0
f28690
f11ed4
0
f11030
f284d0
f11044
1015a478
f11010
f11030
10214d75
f11048
1016db58
f11010
0
f11ed4

Execution completed.
714085 bytecodes executed
9 thread switches
741 classes in the system (including system classes)
3657 dynamic objects allocated (104056 bytes)
1 garbage collections (0 bytes collected)
*ALERT: java/lang/ClassFormatError: Bad version *information.
Execution completed.
714085 bytecodes executed
9 thread switches
741 classes in the system (including system classes)
3657 dynamic objects allocated (104056 bytes)
1 garbage collections (0 bytes collected)

Process finished with exit code 0

Any idea to fix this?

0

Hello Vijay,

*ALERT: java/lang/ClassFormatError: Bad version *information.


Seems that you have problems with class format. It might be caused by inconsistency
between jdk (sdk in idea terms) and emulator. Please, try to compile with
1.4 jdk (for WTK2.2).

Thank you.

-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

Thx for pointing out. That really helped! But now I'm getting the
following and the emulator dies:

C:\WTK22\bin\emulator -classpath
C:\WTK22\lib\midpapi20.jar;C:\WTK22\lib\cldcapi11.jar;C:\WTK22\lib\wma
20.jar;C:\WTK22\lib\mmapi.jar;C:\WTK22\lib\j2me-ws.jar;C:\WTK22\lib\js
r75.jar;C:\WTK22\lib\jsr082.jar;C:\WTK22\lib\jsr184.jar;C:\prgs\TestJ2
me\TestJ2me.jar -Xdescriptor:C:\prgs\TestJ2me\TestJ2me.jad
-Xdevice:DefaultGrayPhone

Running with storage root DefaultGrayPhone

Method............: 1016db58
'com/sun/midp/midlet/MIDletState.createMIDlet (static)'

Stack Chunk.......: f11010

Frame Pointer.....: f11068

Current IP........: 101f1715 = 101f1707 + offset 14

Previous Frame....: f11030

Previous IP.......: 10214d75 (offset 22)

Frame size........: 7 (1 arguments, 6 local variables)

Argument[0].......: f11ed4

Local[1]..........: 0

Local[2]..........: f11030

Local[3]..........: f284d0

Local[4]..........: f11044

Local[5]..........: 1015a478

Local[6]..........: f11010

Operand[1]........: f11ed4

Method............: 10184618 'com/sun/midp/midlet/Selector.run
(virtual)'
Stack Chunk.......: f11010
Frame Pointer.....: f11030
Current IP........: 10214d75 = 10214d5f + offset 22
Previous Frame....: 0
Previous IP.......: 1
Frame size........: 6 (1 arguments, 5 local variables)
Argument[0].......: f12114
Local[1]..........: f28690
Local[2]..........: f11ed4
Local[3]..........: 0
Local[4]..........: 0
Local[5]..........: 0
Operand[1]........: f28690
VM status:
Instruction pointer.: 101f1715 (offset within invoking method: 14)
Next instruction....: 0x4c
Frame pointer.......: f11068
Local pointer.......: f1104c
Stack size..........: 128; sp: f11080; ranges: f11018-f11218;
Contents of the current stack frame:
f1104c: f11ed4 (lp)
f11050: 0
f11054: f11030
f11058: f284d0
f1105c: f11044
f11060: 1015a478
f11064: f11010
f11068: f11030 (fp)
f1106c: 10214d75
f11070: f11048
f11074: 1016db58
f11078: f11010
f1107c: 0 (end of frame)
f11080: f11ed4 (sp)
Execution stack contains 108 items:
f12114 f28690 f11ed4 0 0 0 0 1 f11014 10184618 f11010 0
f28690 f11ed4 0 f11030 f284d0 f11044 1015a478 f11010 f11030
10214d75 f11048 1016db58 f11010 0 f11ed4

Execution completed.
714085 bytecodes executed
9 thread switches
741 classes in the system (including system classes)
3657 dynamic objects allocated (104056 bytes)
1 garbage collections (0 bytes collected)
*ALERT: java/lang/ClassFormatError: Bad version *information.
Execution completed.
714085 bytecodes executed
9 thread switches
741 classes in the system (including system classes)
3657 dynamic objects allocated (104056 bytes)
1 garbage collections (0 bytes collected)
Process finished with exit code 0

Any idea to fix this?



0

Please sign in to leave a comment.