Calling native methods in a package
843829Jun 18 2002 — edited Jun 21 2002Hi!
We have a problem when calling native methods in a class which is in a package. As you can see from the code below we have a class making an instance of a class<testBando> which makes a instance of another class<Bando> which contains the native methods. When running the program we get the error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: initialize
at test2.Bando.initialize(Native Method)
at test.testBando.<init>(testBando.java:10)
at Main.main(Main.java:5)
When we take the class that calls the native methods out of any package every thing works fine! Can you not call native methods inside a package or what are we doing wrong?
// testBando.java
package test;
import test2.*;
public class testBando {
Bando b;
public testBando() {
b = new Bando();
b.initialize();
}
}
// Bando.java
package test2;
public class Bando {
public native void initialize();
static {
System.loadLibrary("bando");
}
}
// Main.java
import test.*;
public class Main {
public static void main(String[] args) {
new testBando();
}
}