In Eclips开发者_如何学JAVAe I get this eror:
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.nokia.mid.impl.isa.util.SharedObjects.nativeSetTable(Ljava/util/Hashtable;)Ljava/util/Hashtable;
I can see SharedObjects, but nativeSetTable doesn't seem to be a method. It might however be hidden -> I don't have access to the source code.
This was my code:
connection = (HttpConnection)Connector.open(this.url);
This is the trace:
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.nokia.mid.impl.isa.util.SharedObjects.nativeSetTable(Ljava/util/Hashtable;)Ljava/util/Hashtable; at com.nokia.mid.impl.isa.util.SharedObjects.nativeSetTable(Native Method) at com.nokia.mid.impl.isa.util.SharedObjects.createTable(SharedObjects.java:465) at com.nokia.mid.impl.isa.util.SharedObjects.(SharedObjects.java:181) at com.nokia.mid.impl.isa.io.GeneralSharedIO.(GeneralSharedIO.java:67) at com.sun.midp.io.ConnectionBaseAdapter.checkForPermission(ConnectionBaseAdapter.java:236) at com.sun.midp.io.ConnectionBaseAdapter.openPrim(ConnectionBaseAdapter.java:205) at com.sun.midp.io.ConnectionBaseAdapter.openPrim(ConnectionBaseAdapter.java:178) at com.sun.midp.io.InternalConnector.openPrim(InternalConnector.java:254) at com.sun.midp.io.InternalConnector.open(InternalConnector.java:153) at javax.microedition.io.Connector.open(Connector.java:138) at javax.microedition.io.Connector.open(Connector.java:120) at javax.microedition.io.Connector.open(Connector.java:104)
I think that nativeSetTable()
is protected or private, that's why you don't see it. And moreover nativeSetTable()
is a native method, which means that it is based on native code (already compiled for a specific processor and available in a specific lib [ie. a DLL]).
UnsatisfiedLinkError
means that this particular method couldn't be retrieved and executed properly.
Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native.
This means that your Java ME emulator must have missing librairies. You should try to reinstall it.
Resources :
- Javadoc -
UnsatisfiedLinkError
I guess you are coupling your source code with the wrong version of the nokia mid library.
It could be that your runtime classpath is using a different version of the jar where SharedObjects lives, when compared to your compile-time classpath in Eclipse. I would double-check your classpath settings.
Ok, I found one reason:
I created a test class in java to test my code, just a plain java file (with main method). And I ran it as a plain java application. Then, it doesn't work. But after I tried it in a Midlet, I didn't get the error!
精彩评论