Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » integrate jni library(UnsatisfiedLinkError on jni method call)
integrate jni library [message #529583] Mon, 26 April 2010 13:37 Go to next message
Stella Levin is currently offline Stella LevinFriend
Messages: 89
Registered: July 2009
Member
Hi, I defined external jar with jni library as separate plugin A, as described in the following links:
http://www.vogella.de/articles/EclipseJarToPlugin/article.ht ml
http://www.eclipsezone.com/eclipse/forums/t49342.html
I have a plugin B, dependent on plugin A. In invocation of the cdm.buildRtlModel method it calls to jni method and fails with UnsatisfiedLinkError exception.
public class RTL {	
    static {
        try {
            System.loadLibrary("cdmjava");
            System.out.println("-I- Success to load native cdmjava library");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
public static void buildDesign() {
		String rtl = new String("/home/somedir");
		cdmOccTop occTop = cdm.buildRtlModel("somename", rtl);

The observations are:


  1. It has the jni library in java.library.path, I printed it with System.getProperty("java.library.path")
  2. It succeeded to load the library and print the next statement -I- Success to load native cmdjava library
  3. It fails on the method cdm.buildRtlModel on call to jni method.
  4. This method is defined in the jni library



What is wrong?
Any clue will be appreciated.
Re: integrate jni library [message #531384 is a reply to message #529583] Tue, 04 May 2010 17:01 Go to previous message
Stella Levin is currently offline Stella LevinFriend
Messages: 89
Registered: July 2009
Member
I reduce the problem: the jni method is invocated when I run main as java application and fails when I run it within plugin.
External plugin has one native and one regular method. Regular method always succeed. Native library is also succeed to load - I get "-I- Success to load". The interface of native library is ok - I checked with javah.
package bbb;
public class aaa {
  public final static native long someMethod(String jarg1);
  public static void otherMethod() {
        System.out.println("Jar containing bbb.aaa.otherMethod() is loaded ok");
}
};

The class calling them:
public class RTL {	
   static {
            System.loadLibrary("kuku");
            System.out.println("-I- Success to load native library");
     }
public static void buildDesign() {
     aaa.otherMethod(); // call regular method - ok
     aaa.someMethod(); // call native method - fails
}

public static void main(String argv[]) {
     aaa.otherMethod(); // call regular method - ok
     aaa.someMethod(); // call native method - ok!!!
}


Any ideas will be appreciated!
Previous Topic:Re: Unsatisfied Version Constraint Error
Next Topic:integrate jni library
Goto Forum:
  


Current Time: Tue Mar 19 07:51:03 GMT 2024

Powered by FUDForum. Page generated in 0.02772 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top