[vtkusers] VTK with Java on OS X just not working
Bernard Giroux
giroux at geo.polymtl.ca
Mon Apr 28 20:49:12 EDT 2008
Le 08-04-28 à 16:15, Timothy Driscoll a écrit :
> hi,
>
> apologies for sending another inquiry about this issue, but I'm
> quite frustrated trying to run VTK with Java wrappings under OS X
> (10.4.11). I've been able to get the VTK-Examples to run just fine,
> by setting the build.properties thusly:
>
> vtk.src.path = /local/vtk/vtk-build/bin
> vtk.classpath = /local/vtk/vtk-build/bin/vtk.jar
Hi Tim,
How do you launch you app? If from the command line, try setting
DYLD_LIBRARY_PATH to include /local/vtk/vtk-build/bin (or is it /usr/
local???). Note also that when launching a jar file from the command
line, any classpath argument is ignored.
If you want to bundle your app the Mac way, you have to follow a few
steps. Here's what I do for my application
- I compile vtk for ppc and i386 separately, in some directory, say /
Users/giroux/Projets/extendVTK/
- I run the attached putFile.pl script in some other directory, to
change the dynamic shared library install names
- I run the attached lipoVTK.pl script to get fat files
- I edit my main jar file with the following command
jar umf manifest.template BHGravi.jar
with manifest.template that contains the single line
Class-Path: sgt_v30.jar vtk.jar Jama-1.0.2.jar looks-2.1.4.jar
AppActivator.jar
- and then I wrap my application in a .app directory that looks like
ls -lR BHGravi.app/
BHGravi.app/:
total 0
drwxr-xr-x 6 giroux staff 204 mai 29 2007 Contents
BHGravi.app/Contents:
total 8
-rw-r--r-- 1 giroux staff 1468 aoû 24 2007 Info.plist
drwxr-xr-x 3 giroux staff 102 sep 6 2006 MacOS
-rw-r--r-- 1 giroux staff 8 sep 6 2006 PkgInfo
drwxr-xr-x 4 giroux staff 136 sep 6 2006 Resources
BHGravi.app/Contents/MacOS:
total 48
-rwxr-xr-x 1 giroux staff 47768 fév 13 2007 JavaApplicationStub
BHGravi.app/Contents/Resources:
total 64
-rw-r--r-- 1 giroux staff 61728 sep 6 2006 BHGraviIcon2.icns
drwxr-xr-x 38 giroux staff 1292 sep 5 2007 Java
BHGravi.app/Contents/Resources/Java:
total 77692
-rw-r--r-- 1 giroux staff 6675 sep 5 2007 AppActivator.jar
-rw-r--r-- 1 giroux staff 1428815 déc 12 20:11 BHGravi.jar
-rw-r--r-- 1 giroux staff 32775 jan 31 2006 Jama-1.0.2.jar
-rwxr-xr-x 1 giroux staff 3994816 mai 22 2007 libvtkCommon.dylib
-rwxr-xr-x 1 giroux staff 1388940 mai 22 2007 libvtkCommonJava.jnilib
-rwxr-xr-x 1 giroux staff 345532 mai 22 2007 libvtkDICOMParser.dylib
-rwxr-xr-x 1 giroux staff 6081728 mai 22 2007 libvtkFiltering.dylib
-rwxr-xr-x 1 giroux staff 2295700 mai 22 2007
libvtkFilteringJava.jnilib
-rwxr-xr-x 1 giroux staff 574532 mai 22 2007
libvtkGenericFiltering.dylib
-rwxr-xr-x 1 giroux staff 246268 mai 22 2007
libvtkGenericFilteringJava.jnilib
-rwxr-xr-x 1 giroux staff 13746152 mai 22 2007 libvtkGraphics.dylib
-rwxr-xr-x 1 giroux staff 2532336 mai 22 2007
libvtkGraphicsJava.jnilib
-rwxr-xr-x 1 giroux staff 3872792 mai 22 2007 libvtkHybrid.dylib
-rwxr-xr-x 1 giroux staff 904472 mai 22 2007 libvtkHybridJava.jnilib
-rwxr-xr-x 1 giroux staff 7413624 mai 22 2007 libvtkIO.dylib
-rwxr-xr-x 1 giroux staff 1144656 mai 22 2007 libvtkIOJava.jnilib
-rwxr-xr-x 1 giroux staff 8545568 mai 22 2007 libvtkImaging.dylib
-rwxr-xr-x 1 giroux staff 1063216 mai 22 2007 libvtkImagingJava.jnilib
-rwxr-xr-x 1 giroux staff 485448 mai 22 2007 libvtkNetCDF.dylib
-rwxr-xr-x 1 giroux staff 5587332 mai 22 2007 libvtkRendering.dylib
-rwxr-xr-x 1 giroux staff 1570596 mai 22 2007
libvtkRenderingJava.jnilib
-rwxr-xr-x 1 giroux staff 7813820 mai 22 2007
libvtkVolumeRendering.dylib
-rwxr-xr-x 1 giroux staff 518652 mai 22 2007
libvtkVolumeRenderingJava.jnilib
-rwxr-xr-x 1 giroux staff 1190668 mai 22 2007 libvtkWidgets.dylib
-rwxr-xr-x 1 giroux staff 468268 mai 22 2007 libvtkWidgetsJava.jnilib
-rwxr-xr-x 1 giroux staff 395724 mai 22 2007 libvtkexoIIc.dylib
-rwxr-xr-x 1 giroux staff 349724 mai 22 2007 libvtkexpat.dylib
-rwxr-xr-x 1 giroux staff 1047564 mai 22 2007 libvtkfreetype.dylib
-rwxr-xr-x 1 giroux staff 141296 mai 22 2007 libvtkftgl.dylib
-rwxr-xr-x 1 giroux staff 315176 mai 22 2007 libvtkjpeg.dylib
-rwxr-xr-x 1 giroux staff 318952 mai 22 2007 libvtkpng.dylib
-rwxr-xr-x 1 giroux staff 384752 mai 22 2007 libvtksys.dylib
-rwxr-xr-x 1 giroux staff 633280 mai 22 2007 libvtktiff.dylib
-rwxr-xr-x 1 giroux staff 149868 mai 22 2007 libvtkzlib.dylib
-rwxr-xr-x 1 giroux staff 936810 jui 12 2007 sgt_v30.jar
-rw-r--r-- 1 giroux staff 1564065 mai 22 2007 vtk.jar
Hope this helps
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lipoVtk.pl
Type: text/x-perl-script
Size: 709 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080428/1bc4a2f7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: putFile.pl
Type: text/x-perl-script
Size: 1446 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080428/1bc4a2f7/attachment-0001.bin>
-------------- next part --------------
>
>
>
> but in my own, very simple Java app, when I do this:
>
> static {
> System.loadLibrary("vtkCommonJava");
> System.loadLibrary("vtkFilteringJava");
> System.loadLibrary("vtkIOJava");
> System.loadLibrary("vtkImagingJava");
> System.loadLibrary("vtkGraphicsJava");
> System.loadLibrary("vtkRenderingJava");
> }
>
>
> I continue to see this run-time error:
>
> Exception in thread "AWT-EventQueue-0"
> java.lang.UnsatisfiedLinkError: /local/vtk/VTK-build/bin/
> libvtkCommonJava.5.1.0.dylib:
> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
> at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
> at java.lang.Runtime.loadLibrary0(Runtime.java:822)
> at java.lang.System.loadLibrary(System.java:993)
>
>
> /local/vtk/VTK-build/bin/libvtkCommonJava.5.1.0.dylib exists. I have
> set:
>
> -Djava.library.path=.:/local/vtk/vtk-build/bin
> -Dclasspath .:/local/vtk/vtk-build/bin/vtk.jar
>
>
> I really can't understand why this doesn't work. the dylibs are all
> in the bin directory. I've tried changing the extensions to jnilib,
> and moving them to /Library/java/Extensions, and setting all sorts
> of environment variables, and nothing has any effect on the error.
> I've recompiled VTK from the CVS head. I compiled it without the
> 'R_PATH' option, which as I understand tells cmake not to embed the
> paths in the files.
>
> my simple app works just fine on linux, which makes it even more
> annoying. ;-)
>
>
> can someone please help? I'd really like to write actual code that
> uses VTK, but I've been stuck trying to point it at the dylibs for
> over a month and I'm about at the end of rope. I think I know just
> enough about java and vtk to be dangerous to myself.
>
>
> thanks for any help,
>
> tim
> --
> earth:usa:virginia:blacksburg
>
> I am behindtherabbit:
> del.icio.us | last.fm | mojo | twitter | www
>
>
>
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
---
Bernard Giroux, ing., Ph.D.
Chercheur
http://geo.polymtl.ca/~giroux
More information about the vtkusers
mailing list