[vtkusers] java.lang.UnsatisfiedLinkError to native lib using VTK with Java

Timothy Driscoll molvisions at mac.com
Wed Apr 23 16:31:15 EDT 2008


On Apr 23, 2008, at 3:13 PM, Amy Squillacote wrote:

> Hi Tim,
>
> I'm copying your email back to the vtkusers list. Please keep the  
> discussion on the list so other people can help with your questions  
> and so the dialog is archived.
>
apologies.  caught by the default list behavior. :-)

I've also tried changing the extensions from dylib to jnilib, and  
copying everything into /usr/lib/java (with concordant changes to  
classpath and java.library.path), but no luck.



>
> Timothy Driscoll wrote:
>> On Apr 23, 2008, at 9:32 AM, Amy Squillacote wrote:
>>
>>> In your java code, are you loading the vtk*Java libraries? The  
>>> code would look something like the following.Also, is the path to  
>>> the vtk*Java.dll files in your path?
>>>
>>> static
>>>  {
>>>  System.loadLibrary("vtkCommonJava");
>>>  System.loadLibrary("vtkFilteringJava");
>>>  ...
>>>  }
>>>
>>
>> hi Amy,
>>
>> thanks for your response.  I was not loading the libraries, but  
>> when I added
>>
>> static
>> {
>> System.loadLibrary("vtkCommonJava");
>> }
>>
>> I get this runtime error:
>>
>> Exception in thread "AWT-EventQueue-0"  
>> java.lang.UnsatisfiedLinkError: /local/vtk/vtk-build/bin/ 
>> libvtkCommonJava.5.1.0.dylib:
>>         at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>>         at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
>>         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
>>         at java.lang.Runtime.loadLibrary0(Runtime.java:822)
>>         at java.lang.System.loadLibrary(System.java:992)
>>
>> I confirmed that this lib is in the dir /local/vtk/bin/, which I  
>> added to classpath and java.library.path, but to no avail.
>>
>> is there some standard location where Java looks for dylibs?  (I  
>> assumed I could put them anywhere as long as I put the dir on  
>> classpath.)
>>
>>
>>> Timothy Driscoll wrote:
>>>> hi,
>>>>
>>>> I'm trying to use VTK within the context of a Java application.   
>>>> I compiled it with Java wrappings, and added the path to the  
>>>> vtk.jar file to my runtime classpath.  I also added the path to  
>>>> the bin directory to java.library.path.
>>>>
>>>> I keep getting this runtime error when I try to call vtkPoints():
>>>>
>>>> Exception in thread "AWT-EventQueue-0"  
>>>> java.lang.UnsatisfiedLinkError: VTKInit
>>>>         at vtk.vtkPoints.VTKInit(Native Method)
>>>>         at vtk.vtkObject.<init>(vtkObject.java:96)
>>>>         at vtk.vtkPoints.<init>(vtkPoints.java:183)
>>>>
>>>>
>>>> so it seems to me that my app is finding the Java wrappings just  
>>>> fine, but can't find the native C++ libraries? (or at least, not  
>>>> VTKInit!).  this happens both from command line and from  
>>>> NetBeans. (fwiw, I'm running under OS X 10.4.11, Java 1.5.0_07.)
>>>>
>>>>



More information about the vtkusers mailing list