简体   繁体   English

使用rm -rf /Library/Java/JavaVirtualMachines/jdkmajor.minor.macro[_update].jdk在Mac上卸载jdk 7后出现问题

[英]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 . 因此,您应该先运行该命令,然后使用vimnano编辑您的.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 : ). 如果它插入此外,图书馆的附加的库,只是抹掉这个特定的库/Librarylibsig.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.

相关问题 Eclipse:搜索以下位置后未找到Java虚拟机:/ Library / Java / JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/ - Eclipse: No Java virtual machine was found after searching the following locations: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/ bash:导出:`“ JAVA_HOME = / Library / Java / JavaVirtualMachines / jdk-9.jdk / Contents / Home”:无效的标识符 - bash: export: `“JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home”': not a valid identifier ProcessException:ExecException:进程'command'/ Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Content/Home/bin/java - ProcessException: ExecException: Process 'command ' /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Content/Home/bin/java Spark-submit 错误行 71:/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/bin/java:Mac 中没有这样的文件或目录 - Spark-submit error line 71: /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/bin/java: No such file or directory in Mac 无法在“/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home/bin/apt”(-1)中找到可执行文件 - Unable to locate an executable at “/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home/bin/apt” (-1) 在OS X上安装Java 7 JDK之后,JavaVirtualMachines仍然显示“ 1.6.0.jdk” - JavaVirtualMachines still says “1.6.0.jdk” after installing Java 7 JDK on OS X 我安装了JRE和JDK 8,但在Eclipse中显示了Java / JavaVirtualMachines / 1.6.0 JDK。 该怎么办? - I installed JRE and JDK 8, but in Eclipse it shows Java/JavaVirtualMachines/1.6.0 JDK. What to do? Java JDK 未显示在 JavaVirtualMachines 文件夹中 - Java JDK not showing up in the JavaVirtualMachines folder 运行 sudo 时无法在“/Library/Java/JavaVirtualMachines/jdk-11.0.4.jdk/Contents/Home/bin/apt”(-1) 找到可执行文件 - Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-11.0.4.jdk/Contents/Home/bin/apt" (-1) when running sudo 无法使用可执行文件/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home/bin/java确定Java版本 - Could not determine Java version using executable /Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home/bin/java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM