mac 上安装了 JDK,但我收到“操作无法完成.无法找到支持 apt 的 Java 运行时."sudo apt 更新 [英] JDK is installed on mac but i'm getting "The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt." sudo apt update
问题描述
我正在尝试在我的 MacOS 终端上运行命令 sudo apt update
I'm trying to run the command sudo apt update
on my terminal in MacOS
我收到此消息作为回应:无法完成操作.无法找到支持 apt 的 Java 运行时.有关安装 Java 的信息,请访问 http://www.java.com.
I'm getting this message in response: The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt. Please visit http://www.java.com for information on installing Java.
我看到了一个类似的问题 此处,但是即使我确保按照解决方案建议安装 JDK,我仍然得到相同的响应.
I saw a similar question here, however even though I made sure to install the JDK like the solution suggested I'm still getting the same response.
我也试过粘贴
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
export JAVA_HOME="$HOME/.jenv/versions/`jenv version-name`"
进入我的 .zshrc.save 文件夹,但没有运气.
Into my .zshrc.save folder and had no luck.
当我在终端中运行 java -version
时,这就是我得到的:
When I run java -version
in the terminal this is what I get back:
java version "15.0.2" 2021-01-19
Java(TM) SE Runtime Environment (build 15.0.2+7-27)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)
推荐答案
20 年前,java 附带了一个名为 apt
的工具:注解处理器工具.这个工具不久就过时了.
20 years ago, java shipped with a tool called apt
: Annotation Processor Tool. This tool was obsolete not much later.
update-node-js-version 所说的是一个完全不相关的工具:它是 Advanced Package Tool
,这是一个管理工具在 debian 和 ubuntu 上安装 - linux 发行版.您不想要在 mac 上运行它,因此您找到的说明完全没有用:这就是如何在 linux 上更新 node-js.你的机器不是 linux.
What that update-node-js-version is talking about, is a completely and totally unrelated tool: It's the Advanced Package Tool
, which is a tool to manage installations on debian and ubuntu - linux distros. You do not want to run this on a mac, and the instructions you found are therefore completely useless: That is how to update node-js on linux. Your machine isn't linux.
四处搜索涉及 brew
的答案,这是 mac 上 apt
的等效项.完全忘记 Java - 这与 Java 无关 - 这只是一个纯粹的巧合.
Search around for answers involving brew
, which is the go-to equivalent of apt
on mac. And completely forget about java - this has NOTHING to do with java - that was just a pure coincidence.
这篇关于mac 上安装了 JDK,但我收到“操作无法完成.无法找到支持 apt 的 Java 运行时."sudo apt 更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!