[英]I have problems after uninstalling jdk 7 on mac with rm -rf /Library/Java/JavaVirtualMachines/jdkmajor.minor.macro[_update].jdk
I have problems after uninstalling jdk 7 on mac book pro with rm -rf /Library/Java/JavaVirtualMachines/jdkmajor.minor.macro[_update].jdk 使用rm -rf /Library/Java/JavaVirtualMachines/jdkmajor.minor.macro[_update].jdk在macbook pro上卸载jdk 7后出现问题
I also have installed java 8 and Intellij works well. 我还安装了Java 8,Intellij效果很好。 But any attempt to run java -version or mvn crashes with error:
但是,任何运行java -version或mvn的尝试都会因错误而崩溃:
dyld: could not load inserted library '/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre/lib/libjsig.dylib' because image not found dyld:无法加载插入的库'/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre/lib/libjsig.dylib',因为找不到图像
[1] 1216 trace trap mvn [1] 1216跟踪陷阱mvn
And in the same time I can build all the projects with IntelliJ. 同时,我可以使用IntelliJ构建所有项目。
I even can't run vim - I have the same mistake. 我什至无法运行vim-我有同样的错误。 So, my questions: 1. What is the correct way to uninstall JDK?
因此,我的问题是:1.卸载JDK的正确方法是什么? 2. What should I do in my situation to restore the system?
2.在我的情况下应如何恢复系统?
Have a look in your .bash_profile and try to look for 看看您的.bash_profile,并尝试寻找
export DYLD_INSERT_LIBRARIES=/usr/lib/libSaturnFE.dylib
export DYLD_FORCE_FLAT_NAMESPACE=1
or anything similar. 或类似的东西。 These might be causing the problem you experience.
这些可能会导致您遇到问题。 Try commenting them out and reload your bash with
尝试将它们注释掉并重新加载bash
exec bash
and see if the problem persist. 并查看问题是否仍然存在。
As mentioned by mattias in his answer, your problem stems from a command in one of your bash startup files, that tells bash to load certain dynamic libraries before it attempts to run any command. 正如mattias在他的回答中提到的那样,您的问题源于bash启动文件之一中的命令,该命令告诉bash在尝试运行任何命令之前先加载某些动态库。
Using unset DYLD_INSERT_LIBRARIES
will only solve this temporarily , for the current running terminal. 对于当前正在运行的终端,使用未
unset DYLD_INSERT_LIBRARIES
只能暂时解决此问题。 So you should fix the problem permanently, by first running that command, and then editing your .bash_profile
and .bashrc
files with vim
or nano
. 因此,您应该先运行该命令,然后使用
vim
或nano
编辑您的.bash_profile
和.bashrc
文件,以永久解决该问题。
If you see a line that says 如果您看到一行显示
export DYLD_INSERT_LIBRARIES=/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre/lib/libjsig.dylib
just remove this line. 只需删除此行。 If it inserts any additional libraries in addition to that libraries, just erase this particular library from
/Library
to libsig.dylib
including the following :
(if it's the last one, then the preceding :
). 如果它插入此外,图书馆的附加的库,只是抹掉这个特定的库
/Library
到libsig.dylib
包括以下内容:
(如果这是最后一个,那么前面的:
)。
Exit Terminal, run it again and make sure your problem has been solved. 退出终端,再次运行它,并确保您的问题已解决。
The procedure you have been following for removing the JDK is the correct one as suggested by Oracle. Oracle所建议的删除JDK的步骤正确。 The problem was that once in the history of that machine, you or whoever was using it added that library to the
DYLD_INSERT_LIBRARIES
environment variable and this caused the problem. 问题在于,一旦在该计算机的历史记录中,您或使用它的任何人都会将该库添加到
DYLD_INSERT_LIBRARIES
环境变量中,从而导致了问题。 Also, the reason why this did not affect IntelliJ is that it is not running through bash
, so bash
commands do not affect it. 同样,之所以不影响IntelliJ,是因为它没有通过
bash
运行,因此bash
命令不影响它。
If you want to remove any other Java version, you should do the same as you did before, but make sure in advance that nothing in DYLD_INSERT_LIBRARIES
refers to something inside /Library/Java/JavaVirtualMachines
. 如果要删除任何其他Java版本,则应执行与以前相同的操作,但要事先确保
DYLD_INSERT_LIBRARIES
中没有任何DYLD_INSERT_LIBRARIES
引用/Library/Java/JavaVirtualMachines
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.