简体   繁体   English

破解Java Mac 10.6

[英]Broken Java Mac 10.6

Some background: 一些背景:

On Mac OS X 10.6 using Macports and I have DYLD_LIBRARY_PATH set in my .bash_profile. 在使用Macports的Mac OS X 10.6上,我在.bash_profile中设置了DYLD_LIBRARY_PATH

The problem: 问题:

When I run java -version I get this error: 当我运行java -version我收到此错误:

Error occurred during initialization of VM VM初始化期间发生错误
Unable to load native library: libjava.jnilib 无法加载本机库: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. 通过一个有用的论坛帖子 ,我发现问题是我的'/ opt / local / lib'目录中的一些文件由于我设置的DYLD_LIBRARY_PATH而导致问题。

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. 当我从'/ opt / local / lib'中删除以libgif,libjpeg,libpng和libtiff开头的文件时,问题就消失了,`java -version'可以工作,但依赖这些文件的端口会中断。

Anyone know of a way I can keep the files and still get java to work properly? 任何人都知道我可以保留文件的方式,仍然让java正常工作? Possibly setting the java path, which I'm not quite sure how to do and all my attempts have failed. 可能设置java路径,我不太确定如何做,我的所有尝试都失败了。

Thanks. 谢谢。

Don't set DYLD_LIBRARY_PATH . 不要设置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. 由于这个env var,动态链接器dyld正在寻找/opt/local/lib/libjpeg.dylib等而不是不同的/System/Library/Frameworks//ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Resources/libJPEG.dylib它需要/System/Library/Frameworks//ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Resources/libJPEG.dylib

This seems to work on OS X Lion: 这似乎适用于OS X Lion:

unset DYLD_LIBRARY_PATH 取消设置DYLD_LIBRARY_PATH

Seems one possible cause of this a file protection problem? 似乎是文件保护问题的一个可能原因? See my post over in this other thread . 另一个帖子中查看我的帖子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM