participate


Sun Java Wireless Toolkit - running the first Midlet
<<   Back to Forum  |   Give us Feedback
This topic has 20 replies on 2 pages.    1 | 2 | Next »
jonathanz1980
Posts:90
Registered: 3/10/04
running the first Midlet   
Nov 7, 2004 11:32 PM

 
hi folks, I just downloaded j2me wireless toolkit 2.1 and I compiled a sample app, this is its code:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
/**
* A simple Hello World midlet
*
* @see MIDlet
*/
public class Test extends MIDlet {
/**
* Main application screen
*/
private Form mainScreen;
private Display myDisplay;
/**
* Creates a screen for our midlet
*/
public Test() {
	myDisplay = Display.getDisplay(this);
	mainScreen = new Form("Hello World");
/*
* Create a string item
*/
	StringItem strItem = new StringItem("Hello",
	"This is a J2ME MIDlet.");
	mainScreen.append(strItem);
}
/**
* Start the MIDlet
*/
public void startApp() throws
	MIDletStateChangeException {
	myDisplay.setCurrent(mainScreen);
}
/**
* Pause the MIDlet
*/
public void pauseApp() {
}
/**
* Called by the framework before
* the application is unloaded
*/
public void destroyApp(boolean unconditional) {
}
}


I clicked on build then run, an generic emulator showed up, when I clicked on launch to run the application, the emnulator exited with the following message on the console. What is wrong? thanks!


Creating project "Test"
Place Java source files in "E:\WTK21\apps\Test\src"
Place application resource files in "E:\WTK21\apps\Test\res"
Place application library files in "E:\WTK21\apps\Test\lib"
Settings updated
Project settings saved
Project settings saved
Building "Test"
Build complete
Running with storage root DefaultColorPhone
Method............: 100d2980 'com/sun/midp/midlet/MIDletState.createMIDlet (static)'
Stack Chunk.......: d17eb0
Frame Pointer.....: d17f0c
Current IP........: 10126161 = 10126153 offset 14
Previous Frame....: d17ed0
Previous IP.......: 1011e41f (offset 22)
Frame size........: 8 (1 arguments, 7 local variables)
Argument[0].......: d19944
Local[1]..........: 0
Local[2]..........: d17ed0
Local[3]..........: d28818
Local[4]..........: d17ee4
Local[5]..........: 100dca28
Local[6]..........: d17eb0
Local[7]..........: 1015c1d8
Operand[1]........: d19944

Method............: 100cd17c 'com/sun/midp/midlet/Selector.run (virtual)'
Stack Chunk.......: d17eb0
Frame Pointer.....: d17ed0
Current IP........: 1011e41f = 1011e409
offset 22
Previous Frame....: 0
Previous IP.......: 1
Frame size........: 6 (1 arguments, 5 local variables)
Argument[0].......: d19be8
Local[1]..........: d28a28
Local[2]..........: d19944
Local[3]..........: 0
Local[4]..........: 0
Local[5]..........: 0
Operand[1]........: d28a28

VM status:
Instruction pointer.: 10126161 (offset within invoking method: 14)
Next instruction....: 0x4c
Frame pointer.......: d17f0c
Local pointer.......: d17eec
Stack size..........: 128; sp: d17f24; ranges: d17eb8-d180b8;
Contents of the current stack frame:
d17eec: d19944 (lp)
d17ef0: 0
d17ef4: d17ed0
d17ef8: d28818
d17efc: d17ee4
d17f00: 100dca28
d17f04: d17eb0
d17f08: 1015c1d8
d17f0c: d17ed0 (fp)
d17f10: 1011e41f
d17f14: d17ee8
d17f18: 100d2980
d17f1c: d17eb0
d17f20: 0 (end of frame)
d17f24: d19944 (sp)
Execution stack contains 112 items:
d19be8
d28a28
d19944
0
0
0
0
1
d17eb4
100cd17c
d17eb0
0
d28a28
d19944
0
d17ed0
d28818
d17ee4
100dca28
d17eb0
1015c1d8
d17ed0
1011e41f
d17ee8
100d2980
d17eb0
0
d19944

Execution completed.
434391 bytecodes executed
8 thread switches
486 classes in the system (including system classes)
2449 dynamic objects allocated (72616 bytes)
1 garbage collections (0 bytes collected)
ALERT: java/lang/ClassFormatError: Bad version information.
Execution completed.
434391 bytecodes executed
8 thread switches
486 classes in the system (including system classes)
2449 dynamic objects allocated (72616 bytes)
1 garbage collections (0 bytes collected)
 
RussianDonz
Posts:85
Registered: 10/12/04
Re: running the first Midlet   
Nov 10, 2004 12:52 AM (reply 1 of 20)  (In reply to original post )

 
According to the specification attributes MIDlet-Name, MIDlet-Vendor and MIDlet-Version must be the same in JAD file and manifest. I think, you wrote bad MIDlet-Version attribute.
ALERT: java/lang/ClassFormatError: Bad version information.
 
harsha_ub
Posts:2
Registered: 5/19/04
Re: running the first Midlet   
Nov 17, 2004 5:16 AM (reply 2 of 20)  (In reply to #1 )

 
Hi People
I too have the same problem. the first MIDlet ran sucessfully but after trying the second one with server connection.......both of them are failing in the same way.

I checked the MIDlet name, MIDlet Vendor and MIDlet Version in both JAD file and Manifest File they are same.............any idea how to go about this.........
 
Karel_Cernohorsky
Posts:2
Registered: 10/9/04
Re: running the first Midlet   
Jan 10, 2005 1:37 PM (reply 3 of 20)  (In reply to original post )

 
Hi I was having the same problem in my case

jdk1.5 generates different bytecode number
try switches -target1.4 -source1.4 for javac.

Karel.
 
vinceliu
Posts:1
Registered: 2/5/05
Re: running the first Midlet   
Feb 5, 2005 4:21 AM (reply 4 of 20)  (In reply to #3 )

 
i have the same quetion
 
anjanesh
Posts:20
Registered: 2/24/05
Re: running the first Midlet   
Feb 28, 2005 3:51 AM (reply 5 of 20)  (In reply to #3 )

 
Thanks Karel.
Im using JDK1.5 and I tried a hunderd times to get it to work. Your answer -target 1.4 -source 1.4 defintely worked !
So much for the much awaited ver 1.5 ? What wrong with this ? Does the update 1.5.1 fix it ?
Thanks
 
J_orge
Posts:1
Registered: 8/11/05
Re: running the first Midlet   
Aug 11, 2005 4:23 PM (reply 6 of 20)  (In reply to #3 )

 
Hi, sorry my stupidity, but how can I switch -target 1.4 -source 1.4. I have the same problem as you with the "java/lang/ClassFormatError: Bad version information." Thax, I'm trying hard!
 
anjanesh
Posts:20
Registered: 2/24/05
Re: running the first Midlet   
Aug 16, 2005 4:48 AM (reply 7 of 20)  (In reply to #6 )

 
set CLDCAPI=C:\WTK21\lib\cldcapi10.jar
set MIDPAPI=C:\WTK21\lib\midpapi20.jar
javac -target 1.4 -source 1.4 -bootclasspath %CLDCAPI%;%MIDPAPI% -d tmpclasses -classpath tmpclasses C:\mypath\myprj\src\Hello.java

works absolutely fine !
 
Voxies
Posts:2
Registered: 9/3/05
Re: running the first Midlet   
Sep 3, 2005 6:46 AM (reply 8 of 20)  (In reply to #7 )

 
i have tried javac -target 1.4 source 1.4 .... yes it worked at first time, but when i run 2nd time, the midlet pop up and nothing happen.. many time i try to javac -target 1.4 and sometime it will work ok, but the second time the midlet just pop up and nothing happen..

izzit JDk1.5 doesnt support J2ME ? what so i do to overcome this problem..

thank you..
 
Voxies
Posts:2
Registered: 9/3/05
Re: running the first Midlet   
Sep 3, 2005 4:27 PM (reply 9 of 20)  (In reply to #8 )

 
sorry, i answer my own question, actually it was because my antivirus and firewall block the emulator..after i disable my antivirus and firewall, the emulator works ok..
 
GilAzaria
Posts:20
Registered: 12/30/05
Re: running the first Midlet   
Dec 30, 2005 4:18 AM (reply 10 of 20)  (In reply to #7 )

 
hey, how do i include specific library files? im making an app for a motorola phone and i have to use these special files or something for midlets.
 
GilAzaria
Posts:20
Registered: 12/30/05
Re: running the first Midlet   
Dec 30, 2005 4:19 AM (reply 11 of 20)  (In reply to #10 )

 
sorry for double post, but it has to include:
import javax.microedition.lcdui.;
import javax.microedition.midlet.
;

just like the first post. the problem is, i dont know how to get them included
 
GilAzaria
Posts:20
Registered: 12/30/05
Re: running the first Midlet   
Dec 30, 2005 4:40 AM (reply 12 of 20)  (In reply to #11 )

 
dont worry, i figured it out
 
acaccia
Posts:1
Registered: 2/7/06
Re: running the first Midlet   
Feb 7, 2006 8:52 AM (reply 13 of 20)  (In reply to original post )

 
I have the same problem too.
Running with storage root DefaultColorPhone
ALERT: java/lang/ClassFormatError: Bad version information.
Method............: 1016db58 'com/sun/midp/midlet/MIDletState.createMIDlet (static)'
Stack Chunk.......: e623f0
Frame Pointer.....: e62448
Current IP........: 101f1715 = 101f1707 + offset 14
Previous Frame....: e62410
Previous IP.......: 10214d75 (offset 22)
Frame size........: 7 (1 arguments, 6 local variables)
Argument[0].......: e632ac
Local[1]..........: 0
Local[2]..........: e62410
Local[3]..........: e785e0
Local[4]..........: e62424
Local[5]..........: 1015a478
Local[6]..........: e623f0
Operand[1]........: e632ac

....

have you found any solution?
 
seteshhindle
Posts:288
Registered: 7/13/05
Re: running the first Midlet   
Mar 2, 2006 2:56 AM (reply 14 of 20)  (In reply to #13 )

 
Nothing wrong with the code mentioned in the first post.

Could be that you are not building the class file defined.

Rgds,

seetesh
 
This topic has 20 replies on 2 pages.    1 | 2 | Next »
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics

About Sun forums
  • Oracle Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Oracle Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums