[vtkusers] EXCEPTION_ACCESS_VIOLATION in Java VTK Program

Haifeng Zhao fsmountain at gmail.com
Mon Jul 3 06:03:38 EDT 2006


Hi guys,

I have written the following simple Cone program in Java with VTK 5.0.
It can be compiled and run successfully. However, it crashes when the
JFrame is closed. It displays some EXCEPTION_ACCESS_VIOLATION problem
related to threads. Any idea?

--------------------------------------------------------
import vtk.*;
import javax.swing.*;
import java.awt.*;

public class Cone extends JFrame {
  private vtkCanvas canvas;

  public Cone() {
    super("Cone");
    canvas = new vtkCanvas();
    setSize(512, 512);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    getContentPane().setLayout(new BorderLayout(5,5));
    getContentPane().add(canvas);
    makeCone(canvas);
  }

  private void makeCone(vtkCanvas canvas) {
    vtkConeSource cone = new vtkConeSource();
    vtkPolyDataMapper mapper = new vtkPolyDataMapper();
    mapper.SetInput(cone.GetOutput());
    vtkActor actor = new vtkActor();
    actor.SetMapper(mapper);
    canvas.GetRenderer().AddActor(actor);
  }

  public static void main (String args[]) {
    (new Cone()).setVisible(true);
  }
}
--------------------------------------------------------

-- 
Kind Regards,
Haifeng Zhao



More information about the vtkusers mailing list