Linux Ubuntu Android SDK 管理器未启动 - android:java: not found

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11441928/
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-10-31 05:08:48  来源:igfitidea点击:

Linux Ubuntu Android SDK manager not starting up - android:java: not found

javaandroidlinuxubuntu

提问by Geore Shg

I extracted the android SDK into a folder i made called "/usr/android/android-sdk-linux". I go into "tools/" and double click the executable file "android", click "Run in Terminal" but nothing happens. I also click "Run" but again nothing happens. i run it in terminal (./androidcommand), and i get:

我将 android SDK 提取到我创建的名为“/usr/android/android-sdk-linux”的文件夹中。我进入“工具/”并双击可执行文件“android”,单击“在终端中运行”但没有任何反应。我也点击了“运行”,但同样没有任何反应。我在终端(./android命令)中运行它,我得到:

./android: 1: ./android: java: not found
./android: 1: ./android: java: not found
./android: 110: exec: java: not found

So why is this happening?

那么为什么会发生这种情况呢?

Edit:Here are the results of ~$ java

编辑:这是结果~$ java

* default-jre
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
* gcj-4.5-jre-headless
* openjdk-7-jre-headless

回答by Geore Shg

All i had to do was sudo apt-get install openjdk-7-jdk. Never trying a manual installation again. oh and sorry for my ignorance on the previous answers.

我所要做的就是sudo apt-get install openjdk-7-jdk。永远不要再次尝试手动安装。哦,很抱歉我对以前的答案一无所知。

回答by azwar_akbar

when you are using Debian based Linux Distribution, the better solution if you install JDK manually (not from repository) is by make a symbolic link that point to a java command.

当您使用基于 Debian 的 Linux 发行版时,如果您手动安装 JDK(而不是从存储库),更好的解决方案是创建一个指向 java 命令的符号链接。

I solved this problem. Create a symbolik linknamed /usr/bin/javadan point it to /home/your_name/your_jdk_folder/bin/java

我解决了这个问题。创建一个名为/usr/bin/java符号链接,并将其指向/home/your_name/your_jdk_folder/bin/java

This is the sample command in terminal/konsol

这是终端/konsol 中的示例命令

sudo ln -s /home/azware/tmp/jdk1.7.0_03/bin/java /usr/bin/java

回答by jecolon

Using Ubuntu 14.04 with Sun JDK 1.8 in /opt/jdk I solved this problem with this:

在 /opt/jdk 中使用带有 Sun JDK 1.8 的 Ubuntu 14.04 我解决了这个问题:

sudo update-alternatives --install /usr/local/bin/java java /opt/jdk/bin/java 0
sudo update-alternatives --install /usr/local/bin/javac javac /opt/jdk/bin/javac 0

This uses the Debian-based alternatives system that Ubuntu also uses. Please note that this is in the case that you don't have any other Java (i.e. OpenJDK) installed. If you have another Java installed, chances are you already have an alternative installed for it. Consult the update-alternatives man page to see how the system works.

这使用了 Ubuntu 也使用的基于 Debian 的替代系统。请注意,这是在您没有安装任何其他 Java(即 OpenJDK)的情况下。如果您安装了另一个 Java,很可能您已经为它安装了替代品。请查阅 update-alternatives 手册页以了解系统的工作原理。

回答by hcarver

It looks like you don't have java installed. Try just running java- is that not found?

看起来你没有安装java。尝试运行java- 没有找到吗?

回答by Estel

Make sure that you have the Java6 JDKin particular, installed.

确保您特别安装了 Java6 JDK

回答by user2400432

I was using android studio on ubuntu 14.04, 64bit and this error was caused due to the file permission issues in $home/android-studio/sdk/tools

我在 ubuntu 14.04, 64bit 上使用 android studio,这个错误是由于文件权限问题引起的 $home/android-studio/sdk/tools

$sudo chmod -R 755 ./*

Running the command in $home/android-studio/sdk/toolssolved the problem.

运行命令$home/android-studio/sdk/tools解决了问题。