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

查看:225
本文介绍了mac 上安装了 JDK,但我收到“无法完成操作.无法找到支持 apt 的 Java 运行时."sudo apt 更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆