[vtkusers] Help: Error running Cone example on Linux, Java

Olivier Jock Olivier.Jock at gmx.de
Sat May 3 13:40:30 EDT 2003


Hi, 

thanks for the reply. I tried your tips, Jeff and Philipp. I did several
compile using jdk 1.4, jdk 1.3.1 and a mix of it. But the problem kept
the same. So I tried again different things, because I had the
impression that the problem has something todo with the loading of the
vtk-libraries. 
Now I have found a solution, and I could start the cone example
correctly.

Here comes some explanation together with my solution of the problem: 

The java code is using "System.LoadLibrary" for the loading of the
vtk-libraries. I thought that by setting the "bin" directory of the VTK
compile in my IDE, the java code would find the necessary libraries in
this directory. This wasn't the case. So I inserted some additional java
code in the example "System.setProperty()" to set additional library
paths. But this didn't work, I don't understand why, certainly I do some
fault. So I inserted the VTK libraries in the directery
"/opt/Jbuilder8/Jbuilder8/jdk1.4/jre/lib/i386/client/" because this path
was in the Library paths. And that causes the problem (look at the error
print out).

It seems that VTK using java code only works if the libraries are in the
"bin" directory under the VTK directory. If the libraries are at another
place, I get always my old error.
Instead of using "System.LoadLibrary" I'm using now "System.Load" and as
argument of "System.Load" the full path to the necessary library. And
that works.

It seems to me that there are some dependencies (e.g. relative paths)
from
the vtk-libraries to some necessary program code under the VTK
directory. So
the java program crashes if the vtk-libraries are outside the VTK
directory. But I'm not sure about that, perhaps I have a wrong
understanding of all that. I thought that it suffices to set the paths
to the location of the vtk libraries, to the vtk.jar file and to the
java classes. 

Now I would like to know which files, directories and directory
hierarchy are absolutely necessary when installing a vtk-java
application on a linux computer. Perhaps someone knows about that.

Thank you in advance,

	Olivier


Jeff Lee schrieb:
> 
> philipp.batchelor at kcl.ac.uk wrote:
> 
> >Hi,
> >sorry I can't help directly, but some related information. By
> >coincidence, I got a very similar  error  message today,
> >while running a vtk example in Matlab. This allows me to point out that J.
> >Lee's  suggestion worked for this, after recompiling VTK-4.2.2 with the
> >Java coming  with Matlab (Java 1.3.1 with Blackdown Java-Linux Team Java
> >HotSpot(TM) Server VM    (mixed mode), (but I had to use the jni.h jni_md.h from
> >jdk1.4)),
> >
> this is probably the source of your problems - must use jni.h/jni_md.h
> from the same java distribution as you are compiling against.  You might
> try jdk1.3.1 from sun.
> -Jeff
> 
> >I manage to get vtk code running in Matlab, for example my
> >modified version of SimpleVTK.java. But when I tried to get the
> >coordinates of a point from the ConeSource.GetOutput.GetPoint(...), I got
> >a similar sounding error, see below. Linux is RedHat 7.1, kernel 2.4.2-2.
> >However, note that SimpleVTK.java, and Cone.java <<work>> as standalone
> >program!
> >
> >Error message:
> >----------------------------------------
> >An unexpected exception has been detected in native code outside the VM.
> >Unexpected Signal : 11 occurred at PC=0x50d7683f
> >Function name=_ZN11vtkPointSet8GetPointEi
> >Library=/projects/vtk/linux2.2/vtkNightly/VTK-4.2.2/bin/libvtkCommon.so
> >
> >Current Java thread:
> >        at vtk.vtkPointSet.GetPoint_5(Native Method)
> >        at vtk.vtkPointSet.GetPoint(vtkPointSet.java:32)
> >.........[~300 lines]
> >Stack Trace:
> >  [0] libjvm.so:os::abort(long)~(0x32326469, 0x6c2e3436, 0x4000676f,
> >0x405cb740) + 29 bytes
> >
> >Ph
> >-------------------------------------------------------------------------
> >On Wed, 30 Apr 2003, Olivier Jock wrote:
> >
> >
> >
> >>I want use VTK on SuSE Linux 7.3 with Java (Version: jdk 1.4). The
> >>compilation of VTK (Version 4.2.1 and Version 4.2.2) seems to be ok (the
> >>compiled test examples, e.g. TimeRenderer work fine), but when I try to
> >>execute the first java example in the tutorial (Cone.java) I get
> >>everytime the same error.
> >>
> >>The error output is as follows:
> >>
> >>--------------------------------------
> >>
> >>
> >>An unexpected exception has been detected in native code outside the VM.
> >>Unexpected Signal : 11 occurred at PC=0x4C9E0490
> >>Function=AddHashEntry__12vtkHashTablePvT1+0x60
> >>Library=/opt/Jbuilder8/Jbuilder8/jdk1.4/jre/lib/i386/client/libvtkCommonJava.so
> >>
> >>Current Java thread:
> >>      at vtk.vtkPolyData.VTKCastInit(Native Method)
> >>      at vtk.vtkPolyDataSource.GetOutput_2(Native Method)
> >>      at vtk.vtkPolyDataSource.GetOutput(vtkPolyDataSource.java:20)
> >>      at Cone.main(Cone.java:46)
> >>
> >>Dynamic libraries:
> >>08048000-0804e000 r-xp 00000000 03:04 283724
> >>/opt/Jbuilder8/Jbuilder8/jdk1.4/bin/java
> >>0804e000-0804f000 rw-p 00005000 03:04 283724
> >>/opt/Jbuilder8/Jbuilder8/jdk1.4/bin/java
> >>40000000-40014000 r-xp 00000000 03:04 8861       /lib/ld-2.2.4.so
> >>40014000-40015000 rw-p 00013000 03:04 8861       /lib/ld-2.2.4.so
> >>...
> >>
> >>Local Time = Tue Apr 29 15:39:22 2003
> >>Elapsed Time = 136
> >>#
> >># The exception above was detected in native code outside the VM
> >>#
> >># Java VM: Java HotSpot(TM) Client VM (1.4.1-b21 mixed mode)
> >>#
> >>
> >>-----------------------------------------------
> >>
> >>I don't know what to do. When debugging the source from Cone.java the
> >>following line is causing the problem:
> >>
> >>      coneMapper.SetInput( cone.GetOutput() );
> >>
> >>I have the impression that something is wrong with cone.GetOutput().
> >>
> >>I am glad about any comment regarding this problem.
> >>
> >>      Thanks
> >>
> >>              Olivier
> >>_______________________________________________
> >>This is the private VTK discussion list.
> >>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> >>Follow this link to subscribe/unsubscribe:
> >>http://public.kitware.com/mailman/listinfo/vtkusers
> >>
> >>
> >>
> >
> >
> >_______________________________________________
> >This is the private VTK discussion list.
> >Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> >Follow this link to subscribe/unsubscribe:
> >http://public.kitware.com/mailman/listinfo/vtkusers
> >
> >
> >
> >
> 
> --
> Jeff Lee
> Software Engineer
> Computational Dynamics North America Ltd
> 21 Lafayette Street, Suite 230
> Lebanon NH 03766 USA
> fax:   603 643 9994
> phone: 603 643 9993 x109
> http://www.cd-adapco.com
> 
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers



More information about the vtkusers mailing list