在netbeans中运行j2me应用程序时出现问题

时间:2011-06-22 06:37:15

标签: java java-me netbeans7.0

我对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)

1 个答案:

答案 0 :(得分:3)

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

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