JNI exception, java.lang.UnsatisfiedLinkError

Hi,
I�m trying to call a native method with JNI and the following exception occurs when I try to call the native method setFileName:
Exception occurred during event dispatching:
java.lang.UnsatisfiedLinkError: setFileName
The dll where this method is defined is in the directory c:/winnt/system32, the Windows default path.
Why this exception occurs?
Thanks in advance
carlos

The basic reasons why this would occur are
1. There is something wrong with the path to the dll.
2. You didn't do a "loadLibrary()" on the dll before you called the native method.
3. There is some disconnect between the expected signature of the native method, and the way it is defined in the dll.
If this doesn't help, thenI suggest you post a bit of code (loadLibrary, native method signature, C function signature).

Similar Messages

  • Java Exception: java.lang.UnsatisfiedLinkError

    Database: oracle11g
    Peoplesoft: peopletools8.52
    I created jdbc connection java program and build it as a jar.
    Placed that jar in an PS_HOME/class, while invoking that jar from peoplecode i am getting the error like:
    Java Exception: java.lang.UnsatisfiedLinkError: no ocijdbc10 in java.library.path: during call of packagename.classname

    I'm not sure this is the best forum, perhaps if there is one for jdbc oracle clients it would be better posted there.
    Try searching your Java Exception: java.lang.UnsatisfiedLinkError: no ocijdbc10 in java.library.path: error on google.
    Lots of hits come back.
    My guess is just because App Server processes running via Tuxedo have access to the Oracle libraries they need, does not mean your code in the JVM created by the App Server processes do.
    I would double check your LD_LIBRARY_PATH and ensure any required jar files like maybe $ORACLE_HOME/jdbc/lib/ojdbc6.jar are in ClassPath setting in the appserver config or copied to the class directory. Have you tested your program independently outside of PeopleSoft and made it work there first? That should indicated what requirements you've created by embedding jdbc into PeopleSoft. I've never tried what your doing though, so I'm just making an educated guess, and I don't know all that might be required.

  • Jar file issue. EXCEPTION: java.lang.UnsatisfiedLinkError

    Hey all,
    i'm writing an application that connects to Oracles SCM. I use a lot of the oracle SCM library. Anyway, my application running in oracles jDeveloper works just fine. However when i deploy it to an executable jar file i get the above exception. In the deployment settings i have tried both using the dependency analyzer and including all content. I have selected all libraries that are used in running it within jdeveloper for the deployment. I have posted to the SCM forumn but noone there has any ideas so just wondering if its a problem with jdeveloper or if its just something stupid i've done.
    find the below the full exception im getting when i run the executable jar file. i'd appreciate any ideas/suggestions anyone may have
    cheers
    paul
    Exception occurred during event dispatching:
    java.lang.UnsatisfiedLinkError: TnsAliasToAddress
    at oracle.repos.helpers.environment.OSEnv.TnsAliasToAddress(Native Method)
    at oracle.repos.services.connection.RepositoryConnectDetails.parseConnect(RepositoryConnectDetails.java:365)
    at oracle.repos.services.connection.RepositoryConnectDetails.<init>(RepositoryConnectDetails.java:74)
    at oracle.repos.services.connection.RepositoryConnection.<init>(RepositoryConnection.java:368)
    at ess.ant.scm.ValidateUser.validate(ValidateUser.java:44)
    at ess.ant.scm.ConnectionFrame.connect_actionPerformed(ConnectionFrame.java:175)
    at ess.ant.scm.ConnectionFrame$1.actionPerformed(ConnectionFrame.java:89)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:216)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:230)
    at java.awt.Component.processMouseEvent(Component.java:3715)
    at java.awt.Component.processEvent(Component.java:3544)
    at java.awt.Container.processEvent(Container.java:1164)
    at java.awt.Component.dispatchEventImpl(Component.java:2593)
    at java.awt.Container.dispatchEventImpl(Container.java:1213)
    at java.awt.Component.dispatchEvent(Component.java:2497)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
    at java.awt.Container.dispatchEventImpl(Container.java:1200)
    at java.awt.Window.dispatchEventImpl(Window.java:926)
    at java.awt.Component.dispatchEvent(Component.java:2497)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)

    This tutorial page for JNI API describes how and where Java looks for the dynamic libraries:
    http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/_library.html
    And this is the home page of Java Native Interface (JNI) API:
    http://java.sun.com/j2se/1.4/docs/guide/jni/index.html
    I have tried putting my executable jar in the same folder as
    this dll and including the dll in my path but both to no avail.Again: you mix binary code and JVM byte code. They are loaded
    differently and located differently. classpath means nothing for the binary code.
    "The Win32 VM uses a search path that includes the current directory for the process or one of the directories listed in the PATH environment variable"
    The DLL may be either in the folder where the application (the JRE/JDK) runs, that is where java.exe is, or some other directory on the system PATH (according to the PATH system variable).

  • Exception "java.lang.UnsatisfiedLinkError" with a library

    Hi,
    I'm using Avetana Bluetooth with linux. I have no compilation errors but I get this error when executing:
         Could not find own library libavetanaBT.so. Will try from ld.library.path
    Exception in thread "Thread-0" java.lang.UnsatisfiedLinkError: no libavetanaBT.so in java.library.path
    The library exists and it is in the '/sources/build' folder, and I export the path to the library in $LD_LIBRARY_PATH
    What can I do?
    Thanks

    Re: ./runInstaller problem

  • Exception  java.lang.UnsatisfiedLinkError: getCurrentMemory

    HI guys, i am having the following problem when running any of my programs. It compiles fine, and then produces the following error message at runtime:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: getCurrentMemoryArea0
    at javax.realtime.RealtimeThread.getCurrentMemoryArea0(Native Method)
    at javax.realtime.RealtimeThread.getCurrentMemoryArea(Unknown Source)
    at javax.realtime.RealtimeThread.<init>(Unknown Source)
    at javax.realtime.AsyncEventHandler.<init>(Unknown Source)
    at javax.realtime.Timed$1.<init>(Unknown Source)
    at javax.realtime.Timed.<init>(Unknown Source)
    P.S Please email me if possible ([email protected]) so i can check it a lot easier, as this is pretty important. Once again cheers for any help!

    ompiles fine, and then produces the following error message at runtime:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: getCurrentMemoryArea0
    at javax.realtime.RealtimeThread.getCurrentMemoryArea0(Native Method)
    at javax.realtime.RealtimeThread.getCurrentMemoryArea(Unknown Source)
    at javax.realtime.RealtimeThread.<init>(Unknown Source)
    at javax.realtime.AsyncEventHandler.<init>(Unknown Source)
    at javax.realtime.Timed$1.<init>(Unknown Source)
    at javax.realtime.Timed.<init>(Unknown Source)
    As far as I know, this error will occur only when you miss any DLL required by your application.
    Or you didnt set the correct path of the DLL used by your application
    Dhamo

  • Exception : java.lang.UnsatisfiedLinkError: JMFSecurityManager..

    Dear all,
    I have written an application for transmitting realtime video from one machine to another using JMF. When it comes to receiving video in Linux, the following error is shown. Infact the two libraries libjmxlib.so and libjmutil.so are found in the path /opt/jdk1.5.0_15/jre/lib/ext/. But still the JVM is showing this error.
    java.lang.UnsatisfiedLinkError: JMFSecurityManager: java.lang.UnsatisfiedLinkError: /opt/jdk1.5.0_15/jre/lib/ext/libjmxlib.so: libjmutil.so: cannot open shared object file: No such file or directory
    at com.sun.media.JMFSecurityManager.loadLibrary(JMFSecurityManager.java:206)
    at com.sun.media.renderer.video.XLibRenderer.<init>(XLibRenderer.java:61)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at java.lang.Class.newInstance0(Class.java:350)
    at java.lang.Class.newInstance(Class.java:303)
    at com.sun.media.SimpleGraphBuilder.createPlugIn(SimpleGraphBuilder.java:808)
    at com.sun.media.SimpleGraphBuilder.getPlugInNode(SimpleGraphBuilder.java:647)
    at com.sun.media.SimpleGraphBuilder.verifyTargetPlugins(SimpleGraphBuilder.java:416)
    at com.sun.media.SimpleGraphBuilder.findTarget(SimpleGraphBuilder.java:387)
    at com.sun.media.SimpleGraphBuilder.doBuildGraph(SimpleGraphBuilder.java:220)
    at com.sun.media.SimpleGraphBuilder.buildGraph(SimpleGraphBuilder.java:168)
    at com.sun.media.SimpleGraphBuilder.buildGraph(SimpleGraphBuilder.java:84)
    at com.sun.media.PlaybackEngine$PlayerTControl.buildTrack(PlaybackEngine.java:2102)
    at com.sun.media.PlaybackEngine.doRealize1(PlaybackEngine.java:326)
    at com.sun.media.PlaybackEngine.doRealize(PlaybackEngine.java:300)
    at com.sun.media.RealizeWorkThread.process(BasicController.java:1400)
    at com.sun.media.StateTransitionWorkThread.run(BasicController.java:1339)
    Can anyone tell me what the reason could be?
    Thanks in Advance...

    One of three possible problems (in order of likelyhood)
    First, your library path may be all messed up. Try the following command
    java <whatever> -Djava-library-path=/opt/jdk1.5.0_15/jre/lib/ext/
    That will explicity tell Java where to look for libraries.
    Second, you may not have the correct permissions on those files. SU and make sure they're accessible to your user.
    Third, you'd (maybe) get those errors if you're using the wrong version of the shared objects, which is to say you're running java on the 2.6 kernel with libraries compiled for the 2.4 kernel.

  • Java.lang.UnsatisfiedLinkError: DBDisconnect

    Hi Guys,
    I tried using the Connection pool APIs from db2jcc.jar for DB2 UDB v8.1.
    While i try to execute the following code i got the exception
    java.lang.UnsatisfiedLinkError: DBDisconnect.
    Please help me to find the problem, there is no .dll to be loaded in this regard as for as i concern.
    import java.sql.Connection;
    import java.sql.SQLException;
    import java.sql.DatabaseMetaData;
    import javax.sql.ConnectionEventListener;
    import javax.sql.PooledConnection;
    import javax.sql.ConnectionEvent;
    import com.ibm.db2.jcc.DB2ConnectionPoolDataSource;
    public class DB2Pooling implements ConnectionEventListener {
    private static final String DB_NAME = "SAMPLE";
    private static final String DB_SERVER = "db2admin";
    private static final String DB_USER = "administrator";
    private static final String DB_PASSWORD = "Welcome123";
    public static void main(String[] args) throws SQLException {
         new DB2Pooling().test();
    public void test() throws SQLException {
         System.out.println("1");
         DB2ConnectionPoolDataSource db2ConnectionPoolDataSource = new DB2ConnectionPoolDataSource();
         System.out.println("2");
         db2ConnectionPoolDataSource.setDatabaseName(DB_NAME);
         System.out.println("3");
         db2ConnectionPoolDataSource.setServerName(DB_SERVER);
         System.out.println("4");
         PooledConnection pc = db2ConnectionPoolDataSource.getPooledConnection(DB_USER,DB_PASSWORD);     System.out.println("5");
         pc.addConnectionEventListener(this);
         System.out.println("6");
         Connection c = pc.getConnection();
         System.out.println("7");
         DatabaseMetaData metaData = c.getMetaData();
         System.out.println("8");
         System.out.println("Product name: "+ metaData.getDatabaseProductName());
         System.out.println("9");
         System.out.println("Product version: "+ metaData.getDatabaseProductVersion());
         System.out.println("Driver name: "+ metaData.getDriverName());
         System.out.println("Driver version: "+ metaData.getDriverVersion());
         c.close();
         try {
         java.lang.Thread.sleep(5000);
         } catch (InterruptedException ie) {
    public void connectionClosed(ConnectionEvent event) {
    System.out.println("connectionClosed method called.");
    public void connectionErrorOccurred(ConnectionEvent event) {
    System.out.println("connectionErrorOccurred method called.");
    Bolded code is giving problem..
    thanks in advance

    Hi All,
    I have got a solution for the posted problem. actually the missing code is
    db2ConnectionPoolDataSource.setPortNumber(50000);
    eventhough the default port of DB2 server is 50000, we have to mention it explicitly. otherwise it'll try to load the DLL file and if there is any problem loading the dll, it'll give the above said exception.
    thanks to all those who tried to bring the solution.

  • Windows too - java.lang.UnsatisfiedLinkError: no cis in java.library.path

    There have been many posts of people who get the following exception:
    java.lang.UnsatisfiedLinkError: no cis in java.library.path
    And it is always on solaris only, they don't seem to get it on windows. However, I AM using windows and am getting this error trying to run a simple stand alone java app to connect to a jms topic. I'm trying to connect like so:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");     
    env.put(Context.PROVIDER_URL, "iiop://localhost:3700");
    jndiContext = new InitialContext(env);
    Thus far I have been COMPLETELY unable to get a simple little standalone java app to connect to a jms topic on the sun server. Why is this so @#%$#@ hard? Anyway, even though it compiles file, I get the above exception when I try. I imagine it's a environment varaible/classpath issue. Soooo, can someone please give me the complete list of all required jar/dll files which must be in the classpath, as well as all environment variables which must be set in order to get a simple java app to connect to a jms topic? Please? Thank you.
    Tony

    Sorry, but I have those .dll files in my classpath. Here is the batch file I'm using to try to run my simple standalone app (called SimpleTopicPublisher):
    cls
    setlocal
    set JAVA_HOME=C:\sun\AppServer7\jdk
    set ANT_HOME=C:\prog\java\BOABackOffice\3rdparty\ant
    set IMQ_HOME=C:\sun\AppServer7\imq
    set classpath=.;
    set classpath=%classpath%;C:\prog\java\BOABackOffice\3rdparty\junit\junit.jar
    set classpath=%classpath%;C:\sun\AppServer7\imq\lib\jms.jar;C:\sun\AppServer7\imq\lib\imq.jar;C:\sun\AppServer7\imq\lib\fscontext.jar
    set classpath=%classpath%;C:\sun\AppServer7\lib\appserv-ext.jar;C:\sun\AppServer7\lib\appserv-rt.jar;C:\sun\AppServer7\lib\appserv-admin.jar
    set classpath=%classpath%;C:\sun\AppServer7\bin\cis.dll;C:\sun\AppServer7\bin\libnspr4.dll;C:\sun\AppServer7\bin\libplc4.dll
    set classpath=%classpath%;C:\sun\AppServer7\bin\libplds4.dll;C:\sun\AppServer7\bin\nss3.dll;C:\sun\AppServer7\bin\ssl3.dll
    set path=%path%;%JAVA_HOME%\bin;%ANT_HOME%\bin
    java SimpleTopicPublisher com.ecc.utils.LoggerTopic 1
    endlocal
    I have all the .dll's in my classpath, as well as .jar files that I can think of. Still no luck.
    - Tony

  • I got that Excpetion : java.lang.UnsatisfiedLinkError: java/security/Access

    Dear All,
    i make .class files to .exe my but when i run my exe file then i got that exception ,
    java.lang.UnsatisfiedLinkError: java/security/AccessController.doPrivileged Pos
    sible causes: If you are trying to use J/Direct (@dll.import), check your compiler version (for JVC, requires 4336 or greater.) If you are trying to use RNI, there are new requirements: see documentation.
    i use swing and sql and awt pakeges in my project.
    Please any body Help me,
    me thanksfull,
    mylove_java

    i also want to tell all of u,
    i use swing
    and for converting .class to .exe i use microsoftSDK.
    Reply me,
    mylove_java

  • RMI+Applet+java.lang.UnsatisfiedLinkError

    Hello!
    guys I REALLY need Your help!!!!
    I have the following problem:
    I'd like to use RMI in Java Applet. When I test applet in JBuilder
    everything works fine. But when I try to open the same applet in IE it
    doesnt load and in Java Console I can see the following exception:
    java.lang.UnsatisfiedLinkError:
    java/security/AccessController.doPrivileged Possible causes: If you are
    trying to use J/Direct (@dll.import), check
    your compiler version (for JVC, requires 4336 or greater.) If you are trying
    to use RNI, there are new requirements: see documentation.
    at java/security/AccessController.doPrivileged
    at sun/rmi/server/RemoteProxy.getLogLevel
    at sun/rmi/server/RemoteProxy.<clinit>
    at sun/rmi/server/RemoteProxy.getStub
    at java/rmi/registry/LocateRegistry.getRegistry
    at java/rmi/registry/LocateRegistry.getRegistry
    at java/rmi/Naming.getRegistry
    at java/rmi/Naming.lookup
    at ServerSide/Control.jbInit
    at ServerSide/Control.init
    at com/ms/applet/AppletPanel.securedCall0
    at com/ms/applet/AppletPanel.securedCall
    at com/ms/applet/AppletPanel.processSentEvent
    at com/ms/applet/AppletPanel.processSentEvent
    at com/ms/applet/AppletPanel.run
    at java/lang/Thread.run
    Any help would be appreciated!!
    Thanks in advance!
    Anton Litvinenko
    p.s. I am using IE6.0 , if this makes any sense...
    p.p.s I dont have any NATIVE methods!!!

    Use java plugin instead of microsoft vm.

  • "Exception in thread "main" java.lang.UnsatisfiedLinkError:"  JNI in Linux

    Hi,
    I am writing a simple program to understand how JNI works so that I can use this concept to develop a project. But after running the simple code,
    It gives the following error:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: sum
    at TestJni.main(testJni.java:25)
    My Java code is:
    import java.io.*;
    import java.util.*;
    class TestJni
    // Try to load the native Code library for user Authentication.
    static
    try
    System.loadLibrary( "test" );
    catch( UnsatisfiedLinkError e )
    System.out.println("Could not load native code for user authentication." );
    System.exit(1);
    public static void main( String [] args )
    //TestJni obj = new TestJni();
    System.out.println(TestJni.sum(2, 3));
    public static native int sum( int x, int y );
    TestJni.h looks like:
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class TestJni */
    #ifndef IncludedTestJni
    #define IncludedTestJni
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class: TestJni
    * Method: sum
    * Signature: (II)I
    JNIEXPORT jint JNICALL Java_TestJni_sum
    (JNIEnv *, jclass, jint, jint);
    #ifdef __cplusplus
    #endif
    #endif
    and my C++ code is:
    #include <jni.h>
    #include "TestJni.h"
    #include <stdio.h>
    JNIEXPORT jint JNICALL Java_TestJni_sum(JNIEnv *env, jclass obj, jint x, jint y)
    printf("Inside the native function\n");
    return (x + y);
    Then I am generating my .so file as:
    g++ -o libtest.so sum.cpp -shared -fpic -lcrypt -I//usr/lib/j2se/1.4/include -I/usr/lib/j2se/1.4/include/linux
    and copying the libtest.so file into the folder where I have my TestJni.class file. Then running the java code by:
    java TestJni
    but it gives the "UnsatisfiedLinkError". What to do? :( I have spend 2 days now to solve this problem but I am not getting it.
    I am using ubuntu 7.10 as my OS.
    Please let me know if you can help.

    Thanks for your response. I found that, when I copied the shared library to /usr/lib and
    did: ldconfig -n /usr/lib it worked
    But the problem is, this is my computer, but the computers that I am going to run my actual
    JNI application, have restrictive permission. Could anyone please let me know how I can
    do the work without ldconfig. I mean is there anyway I can configure my .so file's path without
    copying it into the /usr/lib folder and without ldconfig?
    I will appreciate any reply. Thanks.

  • Weblogic server 8.1 JNI module deployment java.lang.UnsatisfiedLinkError

    This is on the weblogic 8.1 Solaris platform.
    We have a module in our application which uses the native shared library and makes JNI called from the J2EE application. We have added the .so files to the LD_LIBRARY_PATH environment variable in our managed server startup scripts. When we start our servers the module works fine. But when we redeploy the J2EE application, the java code is changed but we start getting java.lang.UnsatisfiedLinkError exception when the module is invoked. We are using the staged mode for deployment. We have to shut down the managed servers and restart them every time for this module to start working after the redeployment of the J2EE application.
    Is this a known problem with the JNI based application. Is there any setting that we are missing? Has this problem been fixed in any of the service packs?

    Have you checked to see if your file descriptor setting is set high enough? Disabling native IO is not a very good solution as it will drastically reduce performance.
    --Raheem                                                                                                                                                                                                                                                                                                                                                                   

  • Exception in thread "main" java.lang.UnsatisfiedLinkError

    Exception in thread "main" java.lang.UnsatisfiedLinkError: no LabIfxEC in java.library.path
    (LabIfxEC was compiled by ESQL/C of INFORMIX)
    My Java code as:
    public class LabEC
         public int labnum;
         public LabEC()
              labnum = 0;
         public synchronized native void invocation();
         static
                   System.loadLibrary("LabIfxEC");
         public static void main(String[] args)
              LabEC lec = new LabEC();
              lec.invocation();
              System.out.println("After Invoke : labnum = "+lec.labnum+"\n");
    My .h code as:
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include "/opt/hobo/java1.2/include/jni.h"
    /* Header for class LabEC */
    #ifndef IncludedLabEC
    #define IncludedLabEC
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class: LabEC
    * Method: invocation
    * Signature: ()V
    jfieldID jf;
    jclass jc;
    jobject jo;
    jint newnum;
    JNIEXPORT void JNICALL Java_LabEC_invocation
    (JNIEnv *env, jobject this);
    void TransDataToJava (JNIEnv *env, jobject this);
    int CreatConnection ();
    int CloseConnection ();
    #ifdef __cplusplus
    #endif
    #endif
    My ESQL/C code as:
    #include "LabEC.h"
    #include <stdio.h>
    JNIEXPORT void JNICALL Java_LabEC_invocation( JNIEnv *env,jobject this)
         jc = (*env)->GetObjectClass(env,this);
         jf = (*env)->GetFieldID(env,jc,"labnum","I");
         if( CreatConnection()||GetNumFromDB()||CloseConnection() )
              fprintf(stderr,"ERROR IN CONNECTING DB");
         }else{
              TransDataToJava(env,this);
    void TransDataToJava (JNIEnv *env,jobject this)
         (*env)->SetIntField(env,this,jf,newnum);
    int CreatConnection()
         EXEC SQL BEGIN DECLARE SECTION;
         char userid[] = "informix";
         char password[] = "informix";
         char dbname[] = "dbdycm_new";
         EXEC SQL END DECLARE SECTION;
         EXEC SQL CONNECT TO:dbname USER: userid using: password;
         if ( SQLCODE < 0 ) return -1;
         return 0;
    int GetNumFromDB()
         EXEC SQL BEGIN DECLARE SECTION;
         long numofrow;
         EXEC SQL END DECLARE SECTION;
         EXEC SQL SELECT count(*) into: numofrow from ttrlineinfo;
         if ( SQLCODE != 0 ) return -1;
         newnum = numofrow;
         return 0;
    int CloseConnection ()
         EXEC SQL DISCONNECT CURRENT;
         return 0;
    My makefile code as:
    INCLUDE_IX=-I /opt/informix/incl/esql
    INCLUDE=-I /opt/nmc/include -I /opt/hobo/java1.2/include -I /opt/hobo/java1.2/include/solaris
    FLAG=-G
    libLabIfxEC.so:LabEC.c LabEC.h
         cc $(FLAG) $(INCLUDE) $(INCLUDE_IX) -solibLabIfxEC.so LabEC.c
    LabEC.c:LabEC.ec LabEC.h
         esql -e LabEC.ec include=/opt/nmc/include:/opt/hobo/java1.2/include:/opt/hobo/java1.2/include/solaris
    The Exception as:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no LabIfxEC in java.library.path
    at java.lang.Throwable.fillInStackTrace(Native Method)
    at java.lang.Throwable.<init>(Throwable.java:94)
    at java.lang.Error.<init>(Error.java:50)
    at java.lang.LinkageError.<init>(LinkageError.java:43)
    at java.lang.UnsatisfiedLinkError.<init>(UnsatisfiedLinkError.java:42)
    at java.lang.ClassLoader.loadLibrary(Compiled Code)
    at java.lang.Runtime.loadLibrary0(Runtime.java:471)
    at java.lang.System.loadLibrary(System.java:745)
    at <Unloaded Method>
    I think my LD_LIBRARY_PATH setting is correct. I have been code a pure c library(without ESQL/C code),and it is runing well with Java.
    Please tell me why, thanks very much!
    Yours Alec

    You can verify the settings of the path to your libraries with
    System.out.println(System.getProperty("java.library.path"));before you call System.loadLibrary(), so you know if it is correct.
    I also found this information (for Solaris):
    The shared library file name requires a "lib" prefix and a ".so" extension. Do not include the "lib" prefix or the ".so" extension for the argument that you pass to the System.loadLibrary method.
    I don't know if that helps you solving your problem.

  • FindClass() throws java.lang.UnsatisfiedLinkError exception

    Hi All,
    I am using a JNI to make my C program to communicate with the GUI developed in Java Swings. In my C program I have used FindClass() method to find the java class. While exececuting my C program, I got the following exception,
    Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/jre1.5.0_04/lib/i386/libawt.so: /usr/java/j2sdk1.4.2_08/jre/lib/i386/libmlib_image.so: version `VER_1.1' not found (required by /usr/java/jre1.5.0_04/lib/i386/libawt.so)
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at sun.security.action.LoadLibraryAction.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.awt.NativeLibLoader.loadLibraries(Unknown Source)
    at sun.awt.DebugHelper.<clinit>(Unknown Source)
    at java.awt.Component.<clinit>(Unknown Source)
    I have ensured that the libawt.so and ibmlib_image.so paths are set in LD_LIBRARY_PATH. Inspite of that I am not able to access the java class because of the above mentioned exception. Please help me out in this.
    For your reference, I am attaching the code with this,
    #include <jni.h>
    int main()
         JavaVMOption options[2];
         JNIEnv *env;
         JavaVM *jvm;
         JavaVMInitArgs vm_args;
         long status;
         jclass cls;
         jobject obj;
         jmethodID mid;
         jstring jstr;
         char str[25];
           options[0].optionString =        "-Djava.class.path=/home/maniyan/work/Dhruv_proj/vers/v5";
         options[1].optionString = "-verbose:jni";
         memset(&vm_args, 0, sizeof(vm_args));
            vm_args.version = JNI_VERSION_1_4;
         vm_args.nOptions = 1;
         vm_args.options = options;
         vm_args.ignoreUnrecognized = 1;
         status = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
         printf("status %d\n",status);
         if (status != JNI_ERR)
              printf("Exception %d\n",(*env)->ExceptionCheck(env));
              cls = (*env)->FindClass(env, "frame_main_v1");
              printf("Exception %d\n",(*env)->ExceptionCheck(env));
              if ((*env)->ExceptionCheck(env)) {
              (*env)->ExceptionDescribe(env);
              (*env)->ExceptionClear(env);
         if(cls !=0)
                 //printf("am here\n");
              mid = (*env)->GetStaticMethodID(env, cls, "display_message", "(Ljava/lang/String;)V");
              printf("Method %d\n",mid);
              if(mid !=0)
              {      strcpy(str,"Hello world");
                    (*env)->CallStaticCharMethod(env, cls, mid, (*env)->NewStringUTF(env, str));
         (*jvm)->DestroyJavaVM(jvm);
         return 0;
    else {
              printf("some error\n");
              return -1;
    Thanks in adv,
    Cool Dude

    this is like a classpath issue, but for a native library
    basically you need to include the library file in your path info to the JVM

  • Exception occurred during event dispatching: java.lang.UnsatisfiedLinkError

    Hi,
    Greetings. I am watching the following error in linux. I greatly appreciate your help.
    Thanks
    Rajkumar
    Exception occurred during event dispatching:
    java.lang.UnsatisfiedLinkError: no test in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1517)
    at java.lang.Runtime.loadLibrary0(Runtime.java:788)
    at java.lang.System.loadLibrary(System.java:834)
    at test.<clinit>(test.java:3)
    at Test.action(Main27.java:926)
    at java.awt.Component.handleEvent(Component.java:5341)
    at Test.handleEvent(Main27.java:1023)
    at java.awt.Window.postEvent(Window.java:1614)
    at java.awt.Component.postEvent(Component.java:3895)
    at java.awt.Component.dispatchEventImpl(Component.java:3631)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:141)
    at java.awt.Dialog$1.run(Dialog.java:542)
    at java.awt.Dialog$3.run(Dialog.java:569)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Dialog.show(Dialog.java:567)
    at Main27.first(Main27.java:67)
    at Main27.action(Main27.java:163)
    at java.awt.Component.handleEvent(Component.java:5341)
    at java.awt.Component.postEvent(Component.java:3885)
    at java.awt.Component.postEvent(Component.java:3895)
    at java.awt.Component.postEvent(Component.java:3895)
    at java.awt.Component.dispatchEventImpl(Component.java:3631)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

    In your test.java (Which must be yours, since all serious classes have capitalised names) you are trying to load a JNI library with
    static {
       System.loadLibrary("test");
      }Somewhere you should have a library file, I think called libtest.so, but the JVM can't find it.
    Find out where it is and put -Djava.library.path=<the directory>
    on the java command.

Maybe you are looking for