java apt安装无法找到可执行文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37493562/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 02:33:43  来源:igfitidea点击:

apt install unable to locate executable

java

提问by Nutmeg

I have read a few other threads similar to this one on stack overflow, but I've been unable to solve my problem.

我已经阅读了一些与堆栈溢出类似的其他线程,但我一直无法解决我的问题。

I am trying to install a package.

我正在尝试安装一个软件包。

apt install libgnutls28-dev

however, I get the following error.

但是,我收到以下错误。

Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/apt" (-1)

Other people have been able to solve this error by setting the java home environment variable in the terminal.

其他人已经能够通过在终端中设置java home环境变量来解决这个错误。

export JAVA_HOME=/Library/Java/Home

I have tried this, and then run apt install again, but recieved the same error:

我试过这个,然后再次运行 apt install,但收到同样的错误:

Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/apt" (-1)

Any help is appreciated!

任何帮助表示赞赏!

回答by Ben H.

Hey I encountered this when trying to install libsndfile. Turns out I was reading their instructions for Debian/Ubuntu. apt isn't a thing on macosx. You'll want to use an alternative package installer like brew.

嘿,我在尝试安装 libsndfile 时遇到了这个问题。原来我正在阅读他们对 Debian/Ubuntu 的说明。apt 不是 macosx 上的东西。您将需要使用像 brew 这样的替代软件包安装程序。

https://unix.stackexchange.com/questions/359219/error-when-using-apt-on-macos-sierra

https://unix.stackexchange.com/questions/359219/error-when-using-apt-on-macos-sierra

回答by eheller

export JAVA_HOME should point to the directory where the JDK or JRE is installed.

export JAVA_HOME 应该指向安装 JDK 或 JRE 的目录。

JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::") in a console or directly in .bashrc should do the trick under debian

JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::") 在控制台或直接在 .bashrc 中应该可以在 debian 下完成