11

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 (./android command), and i get:

./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

* default-jre
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
* gcj-4.5-jre-headless
* openjdk-7-jre-headless
Geore Shg
  • 1,299
  • 5
  • 23
  • 38

6 Answers6

18

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.

Trufa
  • 39,971
  • 43
  • 126
  • 190
Geore Shg
  • 1,299
  • 5
  • 23
  • 38
15

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.

I solved this problem. Create a symbolik link named /usr/bin/java dan point it to /home/your_name/your_jdk_folder/bin/java

This is the sample command in terminal/konsol

sudo ln -s /home/azware/tmp/jdk1.7.0_03/bin/java /usr/bin/java
azwar_akbar
  • 1,451
  • 18
  • 27
  • that worked in my Ubuntu 14.04 and eclipse kepler. But it's going to be impossible to remember to change this symbolic link every time i update my JRE. There must be an .ini file in eclipse that holds this setting instead. – faizal May 11 '14 at 17:31
3

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

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.

jecolon
  • 188
  • 1
  • 7
1

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

hcarver
  • 7,126
  • 4
  • 41
  • 67
1

Make sure that you have the Java6 JDK in particular, installed.

Estel
  • 2,154
  • 2
  • 18
  • 25
0

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

$sudo chmod -R 755 ./*

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

xav
  • 5,452
  • 7
  • 48
  • 57
user2400432
  • 21
  • 1
  • 4