Could not find tools.jar. /Library/Internet Plug-Ins/ contains a valid JDK installation

原因:java_home指向了JRE路径

通过查看java_home发现第一条是jre(JavaAppletPlugin.plugin)的路径,第二条才是jdk(jdk1.8.0_311.jdk)的路径。

JavaAppletPlugin.plugin 是 JRE

根据docs.oracle.com中的描述,得出:JavaAppletPlugin.plugin 是 JRE。
Uninstalling the JRE on macOS

jdk1.8.0_311.jdk 是 JDK

根据docs.oracle.com中的描述,得出: jdk1.8.0_311.jdk 是 JDK。
Uninstalling the JDK on macOS

解决方法

一、查看JAVA_HOME

Many Java applications need to know the location of a $JAVA_HOME directory. The $JAVA_HOME on Mac OS X should be found using the /usr/libexec/java_home command line tool on Mac OS X 10.5 or later. On older Mac OS X versions where the tool does not exist, use the fixed path “/Library/Java/Home”.

Mac查看java_home的命令:
/usr/libexec/java_home -V

命令执行结果:

/usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    1.8.311.11 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
    1.8.0_311 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

结果解读:
前提,一台返修被格式化后的新电脑,通过oracle官网下载了jdk8 311版本并安装,且并没有装过其他版本。
执行命令后发现打印出两个虚拟机:JavaAppletPlugin.plugin和jdk1.8.0_311.jdk。

二、卸载JRE

卸载jre命令:

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencesPanes/JavaControlPanel.prefPane

三、再次查看java_home,确认是否正确

 /usr/libexec/java_home -V                                      
Matching Java Virtual Machines (1):
    1.8.0_311 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home

附件资料

资料一、卸载Java

MAC系统 JDK 卸载及彻底删除
▌1.删除运行路径和运行环境等

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencesPanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Java

▌2.删除当前版本的jdk

sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk
(注:不确定版本号先查看当前版本 ls /Library/Java/JavaVirtualMachines/ )

▌3.检查是否卸载成功

java -version

▌另外,官方资料如下:
如何在 Mac 上卸载 Java?
Depending on your installation, see the related link:

“卸载JRE”

“卸载JDK”

官方文档:
https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_install_faq.html#A1097743

资料二、卸载JRE(JavaAppletPlugin.plugin)

Uninstalling the JRE on macOS

To uninstall the JRE, you must have Administrator privileges and execute the remove commands either as root or by using the sudo(8) tool.

Remove one directory and one file (a symlink), as follows:

Navigate to /Library/Internet Plug-Ins and remove the JavaAppletPlugin.plugin directory.

Navigate to /Library/PreferencePanes and remove JavaControlPanel.prefpane.

Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software and any changes will be reset by Apple the next time you perform an update of the OS.

官方文档:《JRE的安装与卸载》
https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jre.html#A1096890

资料三、卸载JDK(jdk1.8.0_311.jdk)

Uninstalling the JDK on macOS

To uninstall the JDK, you must have Administrator privileges and execute the remove command either as root or by using the sudo(8) tool.

Navigate to /Library/Java/JavaVirtualMachines and remove the directory whose name matches the following format:Foot1

/Library/Java/JavaVirtualMachines/jdkmajor.minor.macro[_update].jdk

For example, to uninstall 8u6:

% rm -rf jdk1.8.0_06.jdk

Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software and any changes will be reset by Apple the next time you perform an update of the OS.

官方文档:《JDK的安装与卸载》
https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html#CHDBADCG

资料四:下载最新版的JDK并安装:

https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
注:下文中的 *** 代表文件名中的版本号。 # 【bcprov-jdk15on-***.jar中文文档.zip】 中包含: 中文文档:【bcprov-jdk15on-***-javadoc-API文档-中文(简体)版.zip】 jar包下载地址:【bcprov-jdk15on-***.jar下载地址(官方地址+国内镜像地址).txt】 Maven依赖:【bcprov-jdk15on-***.jar Maven依赖信息(可用于项目pom.xml).txt】 Gradle依赖:【bcprov-jdk15on-***.jar Gradle依赖信息(可用于项目build.gradle).txt】 源代码下载地址:【bcprov-jdk15on-***-sources.jar下载地址(官方地址+国内镜像地址).txt】 # 本文件关键字: bcprov-jdk15on-***.jar中文文档.zip,java,bcprov-jdk15on-***.jar,org.bouncycastle,bcprov-jdk15on,***,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,bouncycastle,bcprov,jdk15on,中文API文档,手册,开发手册,使用手册,参考手册 # 使用方法: 解压 【bcprov-jdk15on-***.jar中文文档.zip】,再解压其中的 【bcprov-jdk15on-***-javadoc-API文档-中文(简体)版.zip】,双击 【index.html】 文件,即可用浏览器打开、进行查看。 # 特殊说明: ·本文档为人性化翻译,精心制作,请放心使用。 ·只翻译了该翻译的内容,如:注释、说明、描述、用法讲解 等; ·不该翻译的内容保持原样,如:类名、方法名、包名、类型、关键字、代码 等。 # 温馨提示: (1)为了防止解压后路径太长导致浏览器无法打开,推荐在解压时选择“解压到当前文件夹”(放心,自带文件夹,文件不会散落一地); (2)有时,一套Java组件会有多个jar,所以在下载前,请仔细阅读本篇描述,以确保这就是你需要的文件; # Maven依赖: ``` <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcprov-jdk15on</artifactId> <version>***</version> </dependency> ``` # Gradle依赖: ``` Gradle: implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '***' Gradle (Short): implementation 'org.bouncycastle:bcprov-jdk15on:***' Gradle (Kotlin): implementation("org.bouncycastle:bcprov-jdk15on:***") ``` # 含有的 Java package(包)(此处仅列举3个): ``` org.bouncycastle org.bouncycastle.asn1 org.bouncycastle.asn1.anssi ...... ``` # 含有的 Java class(类)(此处仅列举3个): ``` org.bouncycastle.LICENSE org.bouncycastle.asn1.ASN1ApplicationSpecific org.bouncycastle.asn1.ASN1ApplicationSpecificParser ...... ```
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home 是JavaAppletPlugin插件的安装路径。该路径在Mac系统中用于存放JavaAppletPlugin插件的相关文件和资源。 [1] 该路径是用来解决某些与JavaAppletPlugin插件相关的问题的。如果你遇到了一些与JavaAppletPlugin插件相关的错误或者需要升级或删除插件,你可以使用这个路径来进行操作。比如,你可以通过删除该路径下的AppletPlugin.plugin目录来卸载插件。 [1] 此外,该路径与JDKJava Development Kit)的安装路径有关。如果你在该路径下找到了jdk路径,那么说明你的系统已经安装了JDKJDK是用于开发Java程序的工具包。它包含了编译器、调试器和其他开发工具。如果你需要在Java开发中使用JDK提供的一些工具,你可以按照引用中提到的方法,将tools.jar文件复制到该路径下的lib目录中。这样,你就可以在Java开发过程中使用JDK提供的工具了。 [2 [3<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Could not find tools.jar. /Library/Internet Plug-Ins/ contains a valid JDK installation](https://blog.csdn.net/gongsunjinqian/article/details/121228000)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin](https://blog.csdn.net/GUO_NULL192/article/details/119649802)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值