2

我对 j2me 很陌生。我创建了一个示例程序,但我无法运行该程序。构建失败消息来了。我的代码是:

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

/**
 * @author aneesh
 */
public class httpconnection extends MIDlet  {
    private Command exit, start;
    private Display display;
    private Form form;
    public httpconnection () 
  {

  }
    public void startApp() {
    display = Display.getDisplay(this);
    exit = new Command("Exit", Command.EXIT, 1);
    start = new Command("Start", Command.EXIT, 1);
    form = new Form("Http Connection");
    form.addCommand(exit);
    form.addCommand(start);

    display.setCurrent(form);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }


}

我得到的错误是

java.lang.UnsatisfiedLinkError: /usr/local/netbeans-7.0/mobility/WTK2.5.2/bin/sublime.so: /usr/local/netbeans-7.0/mobility/WTK2.5.2/bin/sublime.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1750)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1646)
    at java.lang.Runtime.load0(Runtime.java:787)
    at java.lang.System.load(System.java:1022)
    at com.sun.kvem.Sublime.<init>(Unknown Source)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
    at java.lang.Class.newInstance0(Class.java:372)
    at java.lang.Class.newInstance(Class.java:325)
    at com.sun.kvem.Lime.createLime(Unknown Source)
    at com.sun.kvem.KVMBridge.<init>(Unknown Source)
    at com.sun.kvem.KVMBridge.getBridge(Unknown Source)
    at com.sun.kvem.midp.MIDP.run(Unknown Source)
    at com.sun.kvem.environment.EmulatorInvoker.runEmulatorImpl(Unknown Source)
    at com.sun.kvem.environment.EmulatorInvoker.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at com.sun.kvem.environment.JVM.main(Unknown Source)
NetBeansProjects/VDCustomComponents1/nbproject/build-impl.xml:915: Execution failed with error code 1.
BUILD FAILED (total time: 3 seconds)
4

1 回答 1

3

好像你有 32 位 WTK 和 64 位 JDK。您应该安装匹配的 32 位 JDK 并设置 WTK 以使用它。

从 Sun (Oracle) 网站下载的命令行 WTK 安装程序应该会在安装过程中询问您的 JDK 位置。

于 2011-06-22T08:20:54.970 回答