Broken Java Mac 10.6

僤鯓⒐⒋嵵緔 提交于 2019-12-01 00:48:32

问题


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.


回答1:


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.




回答2:


This seems to work on OS X Lion:

unset DYLD_LIBRARY_PATH




回答3:


Seems one possible cause of this a file protection problem? See my post over in this other thread.



来源:https://stackoverflow.com/questions/1482450/broken-java-mac-10-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!