[vtkusers] VTK 5.0 with Java Wrappings On OS X will not work
Mike Jackson
imikejackson at gmail.com
Mon Jun 26 22:19:03 EDT 2006
You should be able to the the system property "java.library.path"
from with in your java program and then print it out. This might help
figure out where the JVM is trying to look for the libs.
I used to have the code to do this handy.. but I can not find it any
more. It is something like System.getProperty("java.library.path");
or something like that.
--------
Mike Jackson
imikejackson <at> gmail <dot> com
On Jun 26, 2006, at 9:18 PM, Vivek Dwivedi wrote:
> OK I stuck all the .dylib's and .jnilib to /Library/Java/Extensions
>
> When I try to run Cone5.java I get this error:
>
> Exception in thread "main" java.lang.UnsatisfiedLinkError: no
> vtkCommonJava in java.library.path
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
> at java.lang.Runtime.loadLibrary0(Runtime.java:822)
> at java.lang.System.loadLibrary(System.java:992)
> at Cone5.<clinit>(Cone5.java:16)
>
>
> -Vivek
>
>
> On Mon, 26 Jun 2006, Mike Jackson wrote:
>
>> Looks right for the otool stuff... now stick those in /Library/
>> Java/Extensions and see if Java can pick up the libs...
>>
>> --------
>> Mike Jackson
>> imikejackson <at> gmail <dot> com
>>
>>
>>
>> On Jun 26, 2006, at 2:11 PM, Vivek Dwivedi wrote:
>>
>>> OK I rebuild vtk and made sure that skip R path was set to on.
>>> My .dylib and .jnilib files are located in /Users/vivekd/VTK/bin
>>> when doing a otool -L for libvtkCommonJava.dylib I get the
>>> following:
>>> libvtkCommonJava.dylib:
>>> libvtkCommonJava.dylib.5.0 (compatibility version 0.0.0,
>>> current version 0.0.0)
>>> libvtkCommon.dylib.5.0 (compatibility version 0.0.0,
>>> current version 0.0.0)
>>> libvtksys.dylib.5.0 (compatibility version 0.0.0, current
>>> version 0.0.0)
>>> /System/Library/Frameworks/AppKit.framework/Versions/C/
>>> AppKit (compatibility version 45.0.0, current version 824.38.0)
>>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
>>> current version 88.1.5)
>>> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0,
>>> current version 7.4.0)
>>> /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0,
>>> current version 1.0.0)
>>> for libvtkCommonJava.jjnilib
>>> libvtkCommonJava.jnilib:
>>> libvtkCommonJava.dylib.5.0 (compatibility version 0.0.0,
>>> current version 0.0.0)
>>> libvtkCommon.dylib.5.0 (compatibility version 0.0.0,
>>> current version 0.0.0)
>>> libvtksys.dylib.5.0 (compatibility version 0.0.0, current
>>> version 0.0.0)
>>> /System/Library/Frameworks/AppKit.framework/Versions/C/
>>> AppKit (compatibility version 45.0.0, current version 824.38.0)
>>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
>>> current version 88.1.5)
>>> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0,
>>> current version 7.4.0)
>>> /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0,
>>> current version 1.0.0)
>>> I don't know if this is correct or not...
>>> -Vivek
>>> On Jun 26, 2006, at 10:51 AM, Mike Jackson wrote:
>>>> There are a few things that come to mind in all of this. Dynamic
>>>> Libs on OS X sometimes have their paths embedded in the library
>>>> itself so when you link against them the target library or
>>>> executable can know where to find the source libs. This is OK
>>>> for development when libs and executables are not moving around,
>>>> but in some circumstances there can be problems with this setup,
>>>> especially if you need to move the final libs to another
>>>> directory, like /Library/Java/Extensions after compilation. The
>>>> problem becomes when you move it to that new locations, the
>>>> loader is still expecting them in the old location because that
>>>> old location is encoded in the actual library itself.
>>>> Things that you might want to check are:
>>>> ANY library that is built with CMake; Check each one with
>>>> "otool -L" and report what comes back. If you the path to your
>>>> vtk build directory then you have a few choices:
>>>> 1: in Cmake, check for "skip R path" - Make sure it is ON.
>>>> This will NOT embed the paths in the libraries. Now you can move
>>>> the libs to somewhere that java knows about, like /Library/java/
>>>> Extensions.
>>>> 2: You can use "install_name_tool" to change the embedded
>>>> paths. This requires some up front knowledge of the libs, the
>>>> initial path encoded and the final path you want to encode. Read
>>>> the man page for this tool and google a bit to find all the
>>>> caveats.
>>>> Try these things and let the list know. Maybe we can figure
>>>> something out...
>>>> --------
>>>> Mike Jackson
>>>> imikejackson <at> gmail <dot> com
>>>> On Jun 26, 2006, at 10:28 AM, Vivek Dwivedi wrote:
>>>>> Hello:
>>>>> After 3 weeks of frustration I have come to the conclusion that
>>>>> VTK 5.0 with Java Wrappings will not work on OS X 10.4.x. I
>>>>> will detail my steps below so that hopefully someone will tell
>>>>> me my mistakes.
>>>>> my current hardware configuration:
>>>>> Dual 2 GHz PowerPC G5 - 2.5 GB DDR SDRAM
>>>>> OS - Mac OS X 10.4.6
>>>>> Java -
>>>>> java version "1.5.0_06"
>>>>> Java(TM) 2 Runtime Environment, Standard Edition (build
>>>>> 1.5.0_06-112)
>>>>> Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode,
>>>>> sharing)
>>>>> VTK - Downloaded from vtk.org version 5.0.0
>>>>> CMAKE- CMake Version 2.4 - patch 2
>>>>> Downloaded VTK as a .tar.gz and expanded to /Users/vivekd
>>>>> creating a VTK folder
>>>>> cd to VTK folder typed ccmake ../vtk
>>>>> Here is the CCMAKE options:
>>>>> BUILD_EXAMPLES ON
>>>>> BUILD_SHARED_LIBS ON
>>>>> CMAKE_BACKWARDS_COMPATIBILITY 2.4
>>>>> CMAKE_BUILD_TYPE
>>>>> CMAKE_INSTALL_PREFIX /usr/local
>>>>> CMAKE_OSX_ARCHITECTURES ppc
>>>>> CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk
>>>>> VTK_DATA_ROOT VTK_DATA_ROOT-NOTFOUND
>>>>> VTK_USE_CARBON OFF
>>>>> VTK_USE_COCOA OFF
>>>>> VTK_USE_PARALLEL OFF
>>>>> VTK_USE_RENDERING ON
>>>>> VTK_USE_RPATH OFF
>>>>> VTK_USE_X ON
>>>>> VTK_WRAP_JAVA ON
>>>>> VTK_WRAP_PYTHON OFF
>>>>> VTK_WRAP_TCL OFF
>>>>> I configured
>>>>> I then toggled to advanced mode and changed the following Paths:
>>>>> JAVACOMMAND /System/Library/Frameworks/JavaVM.framework/
>>>>> Versions/1.5/Commands/java
>>>>> JAVA_ARCHIVE /System/Library/Frameworks/JavaVM.framework/
>>>>> Versions/1.5/Commands/jar
>>>>> JAVA_AWT_INCLUDE_PATH /System/Library/Frameworks/
>>>>> JavaVM.framework/Versions/1.5/Headers
>>>>> JAVA_AWT_LIBRARY -framework JavaVM -framework
>>>>> JavaEmbedding
>>>>> JAVA_COMPILE /System/Library/Frameworks/JavaVM.framework/
>>>>> Versions/1.5/Commands/javac
>>>>> JAVA_INCLUDE_PATH /System/Library/Frameworks/JavaVM.framework/
>>>>> Versions/1.5/Headers
>>>>> JAVA_INCLUDE_PATH2 /System/Library/Frameworks/JavaVM.framework/
>>>>> Versions/1.5/Headers
>>>>> JAVA_RUNTIME /System/Library/Frameworks/JavaVM.framework/
>>>>> Versions/1.5/Commands/java
>>>>> OPENGL_INCLUDE_DIR /usr/X11R6/include
>>>>> OPENGL_gl_LIBRARY -framework OpenGL
>>>>> OPENGL_glu_LIBRARY -framework AGL
>>>>> Configured again and pressed g
>>>>> In my prompt I typed Make
>>>>> and after 45 min. everything compiles fine with no errors.
>>>>> I changed my DYLD_LIBRARY_PATH to point to the location of
>>>>> the .jnilib and .dylib files which are in my bin directory
>>>>> located at /Users/vivekd/VTK/bin using the following command
>>>>> setenv DYLD_LIBRARY_PATH /Users/vivekd/VTK/bin
>>>>> I then set my CLASSPATH to point to the vtk.jar file with the
>>>>> following commands
>>>>> setenv CLASSPATH .:/Users/vivekd/VTK/bin/vtk.jar
>>>>> I then CD to /Examples/Tutorial/Step2/Java
>>>>> I compiled the Cone2.java as follows:
>>>>> javac Cone2.java
>>>>> I then try to run Cone2.java as follows:
>>>>> java Cone2
>>>>> I get the following error:
>>>>> Exception in thread "main" java.lang.UnsatisfiedLinkError: VTKInit
>>>>> at vtk.vtkConeSource.VTKInit(Native Method)
>>>>> at vtk.vtkObject.<init>(vtkObject.java:90)
>>>>> at vtk.vtkAlgorithm.<init>(vtkAlgorithm.java:238)
>>>>> at vtk.vtkPolyDataAlgorithm.<init>
>>>>> (vtkPolyDataAlgorithm.java:58)
>>>>> at vtk.vtkConeSource.<init>(vtkConeSource.java:114)
>>>>> at Cone2.main(Cone2.java:43)
>>>>> I have build and rebuilt VTK...I have placed the Cone2.java
>>>>> example in the bin directory and compiled but I still get the
>>>>> same error......
>>>>> Has anyone been able to get vtk with java wrappings to work on
>>>>> a mac.........
>>>>> Any help and all help will be greatly appreciated.......
>>>>> Thank you
>>>>> -Vivek
>>>>> _______________________________________________
>>>>> 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
>>
More information about the vtkusers
mailing list