4

I have created so many J2ME Applications in NetBeans. now I want to create

J2ME Applications in Eclipse instead of NetBeans.

so I am new to Eclipse and I have installed MTJ Plug-in in Eclipse 3.7.2 Indigo

and also J2ME wireless Toolkit for Devices.

I can create applications and run then but when I am using LWUIT.jar and

make simple Hello world Project then I can not create it.

When I am selecting compiler Level (Complier complaince level in Java

compiler) to 1.3 then I got an exception like,

Running with storage root DefaultColorPhone
java.lang.NoClassDefFoundError: com/sun/lwuit/Display
    at HelloMidlet.startApp(+1)
    at javax.microedition.midlet.MIDletProxy.startApp(+7)
    at com.sun.midp.midlet.Scheduler.schedule(+270)
    at com.sun.midp.main.Main.runLocalClass(+28)
    at com.sun.midp.main.Main.main(+116)
Execution completed.
709909 bytecodes executed
4 thread switches
742 classes in the system (including system classes)
3658 dynamic objects allocated (101416 bytes)
2 garbage collections (87640 bytes collected)

and when I set other compiler level to other like 1.4, 1.5, 1.6 or 1.7 then I

got an exception like,

Running with storage root DefaultColorPhone
Method............: 1016db58 'com/sun/midp/midlet/MIDletState.createMIDlet 

(static)' 
Stack Chunk.......: 194b53c
Frame Pointer.....: 194b5e0
Current IP........: 101f1715 = 101f1707 + offset 14
Previous Frame....: 194b5a8
Previous IP.......: 101d42d4 (offset 52)
Frame size........: 7 (1 arguments, 6 local variables)
Argument[0].......: 194a0d4
Local[1]..........: 194b5a8
Local[2]..........: 101d42d1
Local[3]..........: 194a578
Local[4]..........: 1016d950
Local[5]..........: 194b53c
Local[6]..........: 0
Operand[1]........: 194a0d4

Method............: 1015a558 'com/sun/midp/midlet/Scheduler.schedule 

(virtual)' 
Stack Chunk.......: 194b53c
Frame Pointer.....: 194b5a8
Current IP........: 101d42d4 = 101d42a0 + offset 52
Previous Frame....: 194b574
Previous IP.......: 101dec85 (offset 28)
Frame size........: 7 (2 arguments, 5 local variables)
Argument[0].......: 194a738
Argument[1].......: 1937b98
Local[2]..........: 194a0d4
Local[3]..........: 194b574
Local[4]..........: 101dec81
Local[5]..........: 194b588
Local[6]..........: 1015a478
Operand[1]........: 194a738

Method............: 1016224c 'com/sun/midp/main/Main.runLocalClass (static)' 
Stack Chunk.......: 194b53c
Frame Pointer.....: 194b574
Current IP........: 101dec85 = 101dec69 + offset 28
Previous Frame....: 194b550
Previous IP.......: 101de6fc (offset 116)
Frame size........: 3 (1 arguments, 2 local variables)
Argument[0].......: 194ad1c
Local[1]..........: 1937b98
Local[2]..........: 194b550

Method............: 101621ac 'com/sun/midp/main/Main.main (static)' 
Stack Chunk.......: 194b53c
Frame Pointer.....: 194b550
Current IP........: 101de6fc = 101de688 + offset 116
Previous Frame....: 0
Previous IP.......: 1
Frame size........: 3 (1 arguments, 2 local variables)
Argument[0].......: 194b828
Local[1]..........: 194ad1c
Local[2]..........: 194a114

VM status:
Instruction pointer.: 101f1715 (offset within invoking method: 14)
Next instruction....: 0x4c
Frame pointer.......: 194b5e0
Local pointer.......: 194b5c4
Stack size..........: 256; sp: 194b5f8; ranges: 194b544-194b744;194b270-

194b470;
Contents of the current stack frame:
    194b5c4: 194a0d4 (lp)
    194b5c8: 194b5a8
    194b5cc: 101d42d1
    194b5d0: 194a578
    194b5d4: 1016d950
    194b5d8: 194b53c
    194b5dc: 0
    194b5e0: 194b5a8 (fp)
    194b5e4: 101d42d4
    194b5e8: 194b5c0
    194b5ec: 1016db58
    194b5f0: 194b53c
    194b5f4: 0 (end of frame)
    194b5f8: 194a0d4 (sp)
Execution stack contains 184 items: 
194b828  
194ad1c  
194a114  
0  
1  
194b540  
101621ac  
194b53c  
0  
194ad1c  
1937b98  
194b550  
194b550  
101de6fc  
194b564  
1016224c  
194b53c  
0  
194a738  
1937b98  
194a0d4  
194b574  
101dec81  
194b588  
1015a478  
194b574  
101dec85  
194b588  
1015a558  
194b53c  
0  
194a738  
194a0d4  
194b5a8  
101d42d1  
194a578  
1016d950  
194b53c  
0  
194b5a8  
101d42d4  
194b5c0  
1016db58  
194b53c  
0  
194a0d4  

Execution completed.
707559 bytecodes executed
4 thread switches
740 classes in the system (including system classes)
3583 dynamic objects allocated (99164 bytes)
1 garbage collections (0 bytes collected)
Execution completed.
707559 bytecodes executed
4 thread switches
740 classes in the system (including system classes)
3583 dynamic objects allocated (99164 bytes)
1 garbage collections (0 bytes collected)
ALERT: java/lang/ClassFormatError: Bad version information.

Please Help me if you have any idea regarding this..Thanks in Advance.

Riddhi Barbhaya
  • 1,205
  • 1
  • 11
  • 19

1 Answers1

1

Keep project compiler level as 1.3.

Download Lwuit version 1.5 from http://www.oracle.com/technetwork/java/javame/javamobile/download/lwuit/index.html

Inside lib folder you find LWUIT_MIDP.jar Make sure you use this file.

Update

NoClassDefFoundError: com/sun/lwuit/Display may be caused by the LWUIT jar not being marked as an exported library. Look at Project Properties .. Java Build Path .. Order and Export. LWUIT_MIDP.jar must be marked.

Telmo Pimentel Mota
  • 4,033
  • 16
  • 22
  • Thanks a lot for your reply, But I had already tried it..In my lib folder ther is.LWUIT_MIDP.jar file and I set compiler level ad 1.3 but I got an exception>> (cont...) – Riddhi Barbhaya Feb 07 '13 at 05:49
  • Running with storage root DefaultColorPhone java.lang.NoClassDefFoundError: com/sun/lwuit/Display at HelloMidlet.startApp(+1) at javax.microedition.midlet.MIDletProxy.startApp(+7) at com.sun.midp.midlet.Scheduler.schedule(+270) at com.sun.midp.main.Main.runLocalClass(+28) at com.sun.midp.main.Main.main(+116) Execution completed. 709909 bytecodes executed 4 thread switches 742 classes in the system (including system classes) 3658 dynamic objects allocated (101416 bytes) 2 garbage collections (87640 bytes collected) – Riddhi Barbhaya Feb 07 '13 at 05:51
  • Hi..Again Many Many Thanks..Ya..I have not marked LWUIT.jar file but even though I can use of it. And If I mark it in order and export then My Project shows an error. Error is not in any class or any midlet or any file..but it is only shown at Project Name and Building workspace continues and cant stop it. – Riddhi Barbhaya Feb 08 '13 at 05:45
  • Can you please tell me Should I change in Java path (Environment variables in My Computer >> Right click >> Properties)?? Because I am running Android Eclipse, J2ME Eclipse and Blackberry Eclipse on the same PC and I changed path when I run blackberry Eclipse, Please help me if you have any idea. Thanks a lot.. – Riddhi Barbhaya Feb 12 '13 at 14:14
  • Java path means CLASSPATH in Environment variables. – Riddhi Barbhaya Feb 12 '13 at 14:30
  • Here is the image..There is no error in any source code. but I got an error in Project if I import LWUIT.jar file in Project. If I tick it as you have said then I got an error. Please see my uploaded image. – Riddhi Barbhaya Feb 13 '13 at 06:36
  • And If I am not marking LWUIT.jar file then even I can use all its components Border Layout, Box Layout etc,,..All components..But when I am trying to run it, Then I can not run it. And If I mark LWUIT.jar file Then I get error in Project but not in source code but only in Project Name. – Riddhi Barbhaya Feb 13 '13 at 07:14
  • To see the error details in Eclipse you must open Window .. Show View .. Problems. – Telmo Pimentel Mota Feb 14 '13 at 10:29
  • This is another image to show errors. Error is regarding Preverification Errors. Please Reply. – Riddhi Barbhaya Feb 19 '13 at 06:50
  • 1
    This might be realetd to .class version onyour library. Can you download LWUIT source code and paste it in your project? Be sure to read the license. – Telmo Pimentel Mota Feb 19 '13 at 11:17
  • Ok..Thanks I will try it for sure. but This LWUIT.jar file which I have, can perfectlye work for Nt beans. I have created projects using it. The Problem is in Eclipse only. and I tried Different Diffrent Eclipses like Juno, Indigo and at last Pulsar but the result is same. Anyway, I will try this now. Thanks for your Reply. – Riddhi Barbhaya Feb 19 '13 at 12:57