Cannot load JNI library from JRuby
----------------------------------
Key: JRUBY-4620
URL: http://jira.codehaus.org/browse/JRUBY-4620
Project: JRuby
Issue Type: Bug
Components: Java Integration
Affects Versions: JRuby 1.4
Reporter: Michal Suchanek
Attachments: Cone.java, Cone.rb
Hello,
I am trying to run a JRuby example for vtk (libvtk-java on Debian).
libvtk-java 5.4.2-5
java version "1.6.0_17"
OpenJDK Runtime Environment (IcedTea6 1.7) (6b17-1.7-1)
OpenJDK Server VM (build 16.0-b13, mixed mode)
jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (OpenJDK
Client VM 1.6.0_17) [i386-java]
The Cone.java which comes with vtk-examples runs as:
LD_LIBRARY_PATH=/usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt
CLASSPATH=/usr/share/java/vtk.jar:. java Cone
The xawt directory in path is required, it does not find awt otherwise
which sucks.
However, JRuby fails at loading JNI libraries completely:
CLASSPATH=/usr/share/java/vtk.jar:. jruby Cone.rb
java.library.path:
/usr/lib/jvm/java-6-openjdk/jre/lib/i386/client:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/jvm/java-6-openjd/jre/../lib/i386:/usr/java/packages/lib/i386:/usr/lib/jni:/lib:/usr/lib
java/lang/ClassLoader.java:1678:in `loadLibrary':
java.lang.UnsatisfiedLinkError: no vtkCommonJava in java.library.path
(NativeException)
from java/lang/Runtime.java:840:in `loadLibrary0'
from java/lang/System.java:1047:in `loadLibrary'
from Cone.rb:18
file -L /usr/lib/jni/libvtkCommonJava.so
/usr/lib/jni/libvtkCommonJava.so: ELF 32-bit LSB shared object, Intel
80386, version 1 (SYSV), dynamically linked, stripped
LD_LIBRARY_PATH=/usr/lib/jni CLASSPATH=/usr/share/java/vtk.jar:. jruby
-d Cone.rb
java.library.path:
/usr/lib/jvm/java-6-openjdk/jre/lib/i386/client:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/jvm/java-6-openjdk/jre/../lib/i386:/usr/lib/jni:/usr/java/packages/lib/i386:/usr/lib/jni:/lib:/usr/lib
java/lang/ClassLoader.java:1678:in `loadLibrary':
java.lang.UnsatisfiedLinkError: no vtkCommonJava in java.library.path
(NativeException)
from java/lang/Runtime.java:840:in `loadLibrary0'
from java/lang/System.java:1047:in `loadLibrary'
from sun/reflect/NativeMethodAccessorImpl.java:-2:in `invoke0'
from sun/reflect/NativeMethodAccessorImpl.java:57:in `invoke'
from sun/reflect/DelegatingMethodAccessorImpl.java:43:in `invoke'
from java/lang/reflect/Method.java:616:in `invoke'
from org/jruby/javasupport/JavaMethod.java:450:in
`invokeDirectWithExceptionHandling'
from org/jruby/javasupport/JavaMethod.java:356:in `invokeStaticDirect'
from org/jruby/java/invokers/StaticMethodInvoker.java:49:in `call'
from org/jruby/runtime/callsite/CachingCallSite.java:310:in
`cacheAndCall'
from org/jruby/runtime/callsite/CachingCallSite.java:149:in `call'
from Cone.rb:22:in `__file__'
from Cone.rb:-1:in `load'
from org/jruby/Ruby.java:628:in `runScript'
from org/jruby/Ruby.java:550:in `runNormally'
from org/jruby/Ruby.java:396:in `runFromMain'
from org/jruby/Main.java:272:in `run'
from org/jruby/Main.java:117:in `run'
from org/jruby/Main.java:97:in `main'
from Cone.rb:18
Complete Java stackTrace
java.lang.UnsatisfiedLinkError: no vtkCommonJava in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1678)
at java.lang.Runtime.loadLibrary0(Runtime.java:840)
at java.lang.System.loadLibrary(System.java:1047)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at
org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:450)
at
org.jruby.javasupport.JavaMethod.invokeStaticDirect(JavaMethod.java:356)
at
org.jruby.java.invokers.StaticMethodInvoker.call(StaticMethodInvoker.java:49)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:310)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:149)
at Cone.__file__(Cone.rb:22)
at Cone.load(Cone.rb)
at org.jruby.Ruby.runScript(Ruby.java:628)
at org.jruby.Ruby.runNormally(Ruby.java:550)
at org.jruby.Ruby.runFromMain(Ruby.java:396)
at org.jruby.Main.run(Main.java:272)
at org.jruby.Main.run(Main.java:117)
Cone.rb is from here: http://www.itk.org/Wiki/VTK/Using_JRuby
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email