4

我在 NetBeans 中创建了很多 J2ME 应用程序。现在我想创建

Eclipse 中的 J2ME 应用程序而不是 NetBeans。

所以我是 Eclipse 新手,我已经在 Eclipse 3.7.2 Indigo 中安装了 MTJ 插件

以及用于设备的 J2ME 无线工具包。

我可以创建应用程序然后运行,但是当我使用 LWUIT.jar 和

制作简单的 Hello world 项目然后我无法创建它。

当我选择编译器级别时(Java 中的编译器投诉级别

编译器)到 1.3 然后我得到一个异常,例如,

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)

当我将其他编译器级别设置为 1.4、1.5、1.6 或 1.7 等其他编译器级别时,我

有一个例外,例如,

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.

如果您对此有任何想法,请帮助我。在此先感谢。

4

1 回答 1

1

保持项目编译器级别为 1.3。

从http://www.oracle.com/technetwork/java/javame/javamobile/download/lwuit/index.html下载 Lwit 1.5 版

在 lib 文件夹中,您可以找到 LWUIT_MIDP.jar 确保使用此文件。

更新

NoClassDefFoundError: com/sun/lwuit/Display 可能是由 LWUIT jar 未标记为导出库引起的。查看项目属性 .. Java 构建路径 .. 排序和导出。必须标记 LWUIT_MIDP.jar。

于 2013-02-06T14:45:50.663 回答