[vtkusers] libvtkJava and libXt

Randy Heiland heiland at ncsa.uiuc.edu
Tue Jan 16 10:55:45 EST 2001


Peter,

Just wondering if you got your problem solved yet?

I have been using VTK & Java together on both an SGI/Irix and a Linux box for
some time (and Windows NT too, but using pre-built libs).

I was able to take your 'xxx' pgm and, after commenting out:

//import Gui.Common.*;

it ran just fine - on both IRIX & Linux.  I don't know where this pkg came
from, but out of curiosity, what happens when you comment it out?

Also, it didn't matter if I commented out loading Xt -- it ran regardless:
  System.loadLibrary("Xt");

FWIW, my build on Linux was --with-{opengl,java,shared,x} (+ contrib &
patented).  And as I reported earlier, I did have to explicitly link in
libXt.so to libvtkJava.so via:

gcc -shared -o libvtkJava.so  \
-L/usr/local/src/vtk3.2/common  -lVTKCommonJava -lVTKCommon \
-L/usr/local/src/vtk3.2/graphics -lVTKGraphicsJava -lVTKGraphics \
-L/usr/local/src/vtk3.2/imaging -lVTKImagingJava -lVTKImaging \
-L/usr/local/src/vtk3.2/patented  -lVTKPatentedJava -lVTKPatented \
-L/usr/local/src/vtk3.2/contrib -lVTKContribJava -lVTKContrib  \
-lGL -ldl -L/usr/X11R6/lib -lXext -lXt -lSM -lICE -lX11 -lm


--Randy

here's your test code, slightly modified so something shows up:
import vtk.*;
import java.io.*;
import java.awt.*;
import javax.swing.*;
//import Gui.Common.*;

/*
 * $Id$
 */

public class xxx
  {
  public xxx()
    {
    }

  static void main(String[] arg)
    {
    System.out.println("xxx.main()");

//    System.loadLibrary("Xt");
    System.loadLibrary("vtkJava");

    JFrame frame = new JFrame("Test");
    frame.setSize(300,200);
//    frame.setBackground(new Color(140, 0, 0));

    JPanel topPanel = new JPanel();
    frame.getContentPane().add( topPanel );

    JButton btn = new JButton( "Press me" );
    topPanel.add(btn);

    frame.pack();
    frame.show();
    }
  }






More information about the vtkusers mailing list