[vtkusers] vtk4.0, java.lang.UnsatisfiedLinkError: VTKInit

Phil Cook p.cook at cs.ucl.ac.uk
Tue May 7 12:59:58 EDT 2002


You need to load the Java libraries. 

Add a static block to your code, and load all the libraries you need. For 
example:

    static {
	System.loadLibrary("vtkCommonJava"); 
	System.loadLibrary("vtkFilteringJava"); 
	System.loadLibrary("vtkIOJava"); 
	System.loadLibrary("vtkImagingJava"); 
	System.loadLibrary("vtkGraphicsJava"); 
	System.loadLibrary("vtkRenderingJava"); 
    }


> Date: Tue, 7 May 2002 12:10:31 -0400 (EDT)
> From: "Stephen R. Saucier" <ssauci1 at umbc.edu>
> To: <vtkusers at public.kitware.com>
> Subject: [vtkusers] vtk4.0, java.lang.UnsatisfiedLinkError: VTKInit
>
> hello,
>   I apologize if this question has been brought up before. I tried to
> search the mailing list archives but unfortunately the search engine was
> not working for me. Browsing manually through the last couple months did
> not yield any results, so I will go ahead and ask:
>
> I am using java jdk1.3.1_02 with the vtk4.0 release (not a nightly build).
> I have a java program which is reading in an xml file which I use to
> describe what data files I want vtk to read, as well as some other
> parameters.
>
> Basically, I read in the xml file and it gives me a list of filenames, and
> from this I create a set of vtkDataSetReaders to read in each of the
> files. When I do so, java is throwing an exception like the following:
> Exception occurred during event dispatching:
> java.lang.UnsatisfiedLinkError: VTKInit
>         at vtk.vtkDataSetReader.VTKInit(Native Method)
>         at vtk.vtkObject.<init>(vtkObject.java:97)
>         at vtk.vtkProcessObject.<init>(vtkProcessObject.java:86)
>         at vtk.vtkSource.<init>(vtkSource.java:86)
>         at vtk.vtkDataReader.<init>(vtkDataReader.java:239)
>         at vtk.vtkDataSetReader.<init>(vtkDataSetReader.java:50)
>         [more lines follow]
>
> here are (summarized) lines of interest within my program:
> vtkDataSetReader[] readers = new vtkDataSetReader[numberOfFiles];
> for( int i = 0; i < numberOfFiles; i++ ) {
>   readers[i] = new vtkDataSetReader( );
> }
>
> the line in which I call 'new vtkDataSetReader( )' is the line throwing
> the exception.
>
> when instead of creating the vtkDataSetReaders dynamically I manually
> create them and list the files I want them to read, everything works fine.
> However, It is not a solution in my case for me to specify the files in
> the source and create the necessary number of vtkDataSetReaders as the
> number of files as well as the files themselves are not static.
>
> I actually had a problem like this before, and I somehow solved it or
> otherwise avoided it, but that is not helping me out now that I am finding
> the problem again. I have a feeling that it has something to do with vtk
> initialization, and things ending up happening out of order. I remember
> that when I had the problem previously, shuffling seemingly unrelated
> instructions seemed to solve the problem, but that is not a possibility
> here as there are no other instructions getting executed between when I
> create the array and when I initialize the individual elements.
>
> Thanks for any help that you can provide;
> if you need any more information I might be able to provide it, however
> including code is difficult because already I have several files which
> make up quite a few lines, and that is not really feasible to attach to an
> email.
>
> Stephen Saucier



More information about the vtkusers mailing list