[vtkusers] problem using VTK 4.2.2 + j2sdk1.4.1

Irina Szabo irina at simbiosys.ca
Mon May 5 21:30:37 EDT 2003


Hi,

I faced a strange problem using the VTK 4.2.2 and j2sdk1.4.1_02 on Linux 
Mandrake 8.2. 

I have a very simple piece of code. 

import javax.swing.*;
public class HelloWorld
{
    static {
        try {
	    System.loadLibrary("vtkCommonJava");
	    System.loadLibrary("vtkFilteringJava");
	    System.loadLibrary("vtkIOJava");
	    System.loadLibrary("vtkImagingJava");
	    System.loadLibrary("vtkGraphicsJava");
	    System.loadLibrary("vtkRenderingJava");
	    System.loadLibrary("vtkHybridJava");
	    System.loadLibrary("vtkPatentedJava");	    
        } catch (UnsatisfiedLinkError e)
        {
            System.err.println("Unable to load vtkJava shared library!");
            System.err.println( e );
        } catch (SecurityException e)
        {
            System.err.println("Security Exception thrown");
            System.err.println( e );
        } // end catch
    }

    public static void main( String args[] )
    {
	JFrame frame = new JFrame("HelloWorldSwing");
	 final JLabel label = new JLabel("Hello World");
	 frame.getContentPane().add(label);
	 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	 frame.pack();
	 frame.setVisible(true);
    } // end main
} // HelloWorld

The vtk libraries are only loaded and not used at all.
During the execution the program crashes with the following error:

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x517601CD
Function=_XmAddHashEntry+0x15
Library=/usr/java/java/jre/lib/i386/libawt.so

Current Java thread:
        at sun.awt.motif.MWindowPeer.pCreate(Native Method)
        at sun.awt.motif.MWindowPeer.create(MWindowPeer.java:79)
        at sun.awt.motif.MComponentPeer.init(MComponentPeer.java:219)
        at sun.awt.motif.MWindowPeer.init(MWindowPeer.java:93)
        at sun.awt.motif.MFramePeer.<init>(MFramePeer.java:58)
        at sun.awt.motif.MToolkit.createFrame(MToolkit.java:197)
        at java.awt.Frame.addNotify(Frame.java:469)
        - locked <0x44c18c48> (a java.awt.Component$AWTTreeLock)
        at java.awt.Window.pack(Window.java:429)
        at ehits.Ehits.main(Ehits.java:662)

Dynamic libraries:
08048000-0804e000 r-xp 00000000 03:05 181007     
/usr/java/j2sdk1.4.1_02/bin/java
0804e000-0804f000 rw-p 00005000 03:05 181007     
/usr/java/j2sdk1.4.1_02/bin/java
40000000-40014000 r-xp 00000000 03:02 77         /lib/ld-2.2.4.so
..........
..........


The program runs fine if no vtk library were loaded.
The program also works fine if the vtk libraries are loaded but the 
HelloWorld class extends the JFrame class and the rest of the code is 
unchanged, i.e. 
"public class HelloWorld" is changed to
"public class HelloWorld extends JFrame"


What could be the problem?
Regards

Irina



More information about the vtkusers mailing list