[vtkusers] Causes of java.io.notserializable exception

Christopher Navarro cnavarro at ncsa.uiuc.edu
Fri Jul 12 11:37:20 EDT 2002


When I try to pass out a vtk java object from one class to another that 
pulls it in as input, I get a not serializable exception.  I've tried 
adding to the class that creates the object

implements java.io.Serializable

However, I still get that exception.  For simplicity of testing, I 
modified a copy of SimpleVTK.  In another file I create the object and 
push it out at output and a 3rd reads that object in.  Any ideas what is 
wrong?  The changes to SimpleVTK are below.  Any ideas what is wrong?  

public class SimpleVTK extends JPanel implements java.io.Serializable {
        static {
                System.loadLibrary("vtkCommonJava");
                System.loadLibrary("vtkRenderingJava");
                System.loadLibrary("vtkImagingJava");
                System.loadLibrary("vtkIOJava");
                System.loadLibrary("vtkFilteringJava");
                System.loadLibrary("vtkGraphicsJava");
        }
    private vtkPanel renWin;
    private vtkConeSource cone;
    private vtkPolyDataMapper coneMapper;
    private vtkActor coneActor;

  public SimpleVTK() {
    setLayout(new BorderLayout());
    // Create the buttons.
    renWin = new vtkPanel();
    cone = new vtkConeSource();
    cone.SetResolution(8);

    coneMapper = new vtkPolyDataMapper();
    coneMapper.SetInput(cone.GetOutput());

    coneActor = new vtkActor();
    coneActor.SetMapper(coneMapper);

    renWin.GetRenderer().AddActor(coneActor);
    add(renWin, BorderLayout.CENTER);
  }



-chris




More information about the vtkusers mailing list