[vtkusers] Binding Java: java.lang.UnsatisfiedLinkError

Leguay Romain romain.leguay at etu.u-bordeaux1.fr
Wed May 26 03:21:31 EDT 2010


Good morning everyone.
I am a new user of vtk. For a project, I need to use VTK library in  
Java environment and Windows XP professional SP3.
I build vtk 5.6 with CMake 2.8 and Mingw Makefile. The compilation  
works just fine with no error. I put the bin path to my user PATH.
Unfortunately, when I try to execute a sample code in Eclipse 3.5, I  
obtain the following message:
java.lang.UnsatisfiedLinkError: N:\VTK\bin\vtkCommonJava.dll: Can't  
find dependent libraries
I verify the path and it's the good one. I try to re-build the library  
with MSys but errors appear at 86% (the Java tests).
If anyone have some issues please help me.

Thanks,
Romain LEGUAY
-------------- next part --------------
package test;

import vtk.*;

public class Test {

  // Constructeur statique qui charge la biblioth?e VTK.
  // Les biblioth?es doivent ?e dans le path de votre syst?.
  static { 
    System.loadLibrary("vtkCommonJava"); 
    System.loadLibrary("vtkFilteringJava"); 
    System.loadLibrary("vtkIOJava"); 
    System.loadLibrary("vtkImagingJava"); 
    System.loadLibrary("vtkGraphicsJava"); 
    System.loadLibrary("vtkRenderingJava"); 
  }

  // Fonction principale
  public static void main (String[] args)
  {
	  System.out.println("java.library.path: " + 
			  System.getProperty("java.library.path"));
	  
	// Cr? une g??ie sph?que
	vtkSphereSource sphere = new vtkSphereSource();
	sphere.SetRadius(1.0);
	sphere.SetThetaResolution(18);
	sphere.SetPhiResolution(18);

	// Transforme la g??ie en primitives graphiques (OpenGL dans notre cas)
	vtkPolyDataMapper map = new vtkPolyDataMapper();
	map.SetInput(sphere.GetOutput());

	// L'acteur repr?nte l'entit?g??ique.
	// Il permet de d?nir sa position, son orientation, sa couleur, etc.
	vtkActor aSphere = new vtkActor();
	aSphere.SetMapper(map);
	aSphere.GetProperty().SetColor(0,0,1); // color blue

	// Nous cr?s un renderer qui va faire le rendu de notre entit?
	vtkRenderer ren1 = new vtkRenderer();
	ren1.AddActor(aSphere);
	ren1.SetBackground(1,1,1); // background color white

	// Nous cr?s une fen?e de rendu
	vtkRenderWindow renWin = new vtkRenderWindow();
	renWin.AddRenderer(ren1);
	renWin.SetSize(300,300);

	// Nous cr?s un interactor qui permet de bouger la cam?.
	vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();
	iren.SetRenderWindow(renWin);

	// Nous lan?s le rendu et l'interaction
	renWin.Render();
	iren.Start();
  }
}


More information about the vtkusers mailing list