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

Amy Squillacote ahs at cfdrc.com
Wed Apr 23 15:13:40 EDT 2008


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.

- Amy

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.)
>
> thanks again for your help,
>
> tim
>
>
>> 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.)
>>>
>>> can anyone please help?
>>>
>>>
>>> thanks a lot,
>>>
>>> tim
>>
>> -- 
>> Amy Squillacote                    Phone: (256) 726-4839
>> Computer Scientist                 Fax: (256) 726-4806
>> CFD Research Corporation           Web: http://www.cfdrc.com
>> 215 Wynn Drive, Suite 501
>> Huntsville, AL  35805
>>
>>
>
>

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805





More information about the vtkusers mailing list