« Return to Thread: Loading java native extensions

Loading java native extensions

by Tim Hanson :: Rate this Message:

Reply to Author | View in Thread

How does one load a dll from JRuby? I have Java wrapper classes (generated by SWIG) that wrap C++ code. Before referencing the Java classes, I need to load the DLL. I tried the following:

irb(main):001:0> java.lang.System.load_library('mydll')
NativeException: java.lang.UnsatisfiedLinkError: no mydll in java.library.path
        from java/lang/ClassLoader.java:1682:in `loadLibrary'
        from java/lang/Runtime.java:822:in `loadLibrary0'
        from java/lang/System.java:992:in `loadLibrary'
        from sun/reflect/NativeMethodAccessorImpl.java:-2:in `invoke0'
        from sun/reflect/NativeMethodAccessorImpl.java:39:in `invoke'
        from sun/reflect/DelegatingMethodAccessorImpl.java:25:in `invoke'
        from java/lang/reflect/Method.java:585:in `invoke'
        ...

mydll.dll is in the PATH. The following java code executed in the same directory, works without a problem:

public class Test {
  public static void main(String[] args) {
    System.out.println("Before");
    System.loadLibrary("mydll");
    System.out.println("After");
  }
}

Is there something that I'm missing? Or a better way to do this?

Thanks,
Tim


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Loading java native extensions