Some background:
On Mac OS X 10.6 using Macports and I have DYLD_LIBRARY_PATH
set in my .bash_profile.
The problem:
When I run java -version
I get this error:
Error occurred during initialization of VM
Unable to load native library: libjava.jnilib
By way of one helpful forum thread, I've discovered the problem is some files in my '/opt/local/lib' directory are causing trouble because of the DYLD_LIBRARY_PATH
I've set.
When I remove the files starting with libgif, libjpeg, libpng and libtiff from '/opt/local/lib', the problem goes away and `java -version' works, but the ports that depend on those files break.
Anyone know of a way I can keep the files and still get java to work properly? Possibly setting the java path, which I'm not quite sure how to do and all my attempts have failed.
Thanks.
Don't set
DYLD_LIBRARY_PATH
. Because of this env var, the dynamic linker dyld, is finding/opt/local/lib/libjpeg.dylib
etc. instead of the different/System/Library/Frameworks//ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Resources/libJPEG.dylib
that it needs.This seems to work on OS X Lion:
unset DYLD_LIBRARY_PATH
Seems one possible cause of this a file protection problem? See my post over in this other thread.