44

I installed Android Studio but it was giving me error that I need to install JDK but JDK was already installed. Then I realized it is asking to install 64bit version of JDK.

Anyway I just downloaded latest JDK 64bit version and set the following in Environment Variable but still Android Studio is giving error:

Error

'tools.jar' seems to be not in Android Studio classpath.  
Please ensure JAVA_HOME points to JDK rather than JRE.

Following paths are set in my Windows 8.

Path in User Variables  
E:\Program Files\Java\jdk1.8.0_25\bin

JAVA_HOME in System Variables  
E:\Program Files\Java\jdk1.8.0_25

Path in System Variables  
E:\Program Files\Java\jdk1.8.0_25\bin

32bit JDK is installed on C drive while 64bit JDK is installed on E drive (as shown above). 32 bit JDK is not being used in any User or System Variables.

I have also restarted the PC.

How do I fix this issue?

Frank Martin
  • 3,147
  • 16
  • 52
  • 73

17 Answers17

105

I had this same problem and was able to fix it after wasting about 3 hours:

Just copy tools.jar from %JAVA_HOME%\lib to (Android Studio Root)\lib

DavChana
  • 1,944
  • 17
  • 34
John Blackberry
  • 1,254
  • 1
  • 9
  • 12
16

check your JAVA_HOME value!

it should be like this

E:\Program Files\Java\jdk1.8.0_25\jre

Kaloglu
  • 1,651
  • 1
  • 20
  • 31
7

First locate in your PC the route of your JDK (for instance: C:\Program Files\Java\jdk1.7.0_45)

then change the JAVA_HOME variable as follows:

  1. Right-click the My Computer icon on your desktop and select Properties
  2. Click the Advanced tab
  3. Click the Environment Variables button
  4. Under System Variables, click New
  5. Enter the variable name as JAVA_HOME
  6. Enter the variable value as the installation path for the Java Development Kit
Tagir Valeev
  • 97,161
  • 19
  • 222
  • 334
David Vargas
  • 71
  • 1
  • 3
4

I installed jdk 1.8.0_51 64bit on Windows7. After that, no JAVA_HOME was defined, so I had to define it myself as described above, but it did not work unless I added a trailing backslash: D:\Programs\Java\jdk1.8.0_51\.

Without the backslash at the end it did not work.

Mick Mnemonic
  • 7,808
  • 2
  • 26
  • 30
Andi
  • 41
  • 1
2

Known issue - my solution was to install JDK 7u80 - worked after that.

https://code.google.com/p/android/issues/detail?id=187048

Shaun Neal
  • 1,183
  • 1
  • 10
  • 12
1

Just Copy the tools.jar from your jdk to Android lib directory.

Suyash Jain
  • 561
  • 7
  • 18
0

In my case I've installed newest Java version without uninstalling older version first. After I've uninstalled the older Java version this error was gone.

Also make sure your JAVA_HOME system variable is set properly, e.g.: Variable Name: JAVA_HOME Variable Value: C:\Program Files\Java\jdk1.8.0_31\

And finally, that you've installed proper version for your OS, x86 or x64.

0

I had exactly the same problem. In my case I finally installed JRE to "C:\Program Files..." and the JDK to my default destination , which is "E:\Program Files..." It seems that the JDK and JRE cannot point to the same place for Android Studio .

0

I had the same issue on windows 7 when I installed Android Studio. I had Jdk 8 on my system. So for me, copying the tools.jar from jdk\lib to androidstudio\lib worked. I found the tools.jar was missing from androidstudio's lib directory. I had set JAVA_HOME in user variable and JDK in system variable.

Indrabhushan
  • 98
  • 10
0

I had the same error -- tools.jar seems to be not in Studio classpath. Please ensure JAVA_HOME points to JDK rather than JRE.

I have a few Java JDKs downloaded. JAVA_HOME was pointing to C:\java\jdk1.7.0_45. When I switched to C:\java\jdk1.7.0_75, it worked. It makes no sense - both have lib/tools.jar. I did a jar tvf on each of the tools.jar files and they were fine. I ran java -version on each java & it ran ok. Dunno - makes no sense.

Platform: Windows 7 Professional - 64-bit v1.10.00.AG B11 Service Pack 1

Meta
  • 77
  • 3
  • 12
0

Installing it to the default installation path instead of a custom one did solve the issue for me.

Source: https://code.google.com/p/android/issues/detail?id=187048#c9

oschloebe
  • 386
  • 1
  • 2
  • 16
0

First locate in your PC the route of your JDK (for instance: First locate in your PC the route of your JDK (for instance: C:\Program Files\Java\jdk1.8.0_11)

then change the JAVA_HOME variable as follows:

Right-click the My Computer icon on your desktop and select Properties Click the Advanced tab Click the Environment Variables button Under System Variables, click New or edit it if there already a path for it ( you should make sure that the path is jdk) Enter the variable name as JAVA_HOME Enter the variable value as the installation path for the Java Development Kit)

Maryam
  • 69
  • 1
  • 1
  • 7
0

1) Just install JDK from here

2) Change JAVA_HOME variable (e.g. C:\Program Files\Java\jdk1.8.0_112)

Dias
  • 101
  • 1
  • 4
0

I add a similar problem on Linux. In my case my JAVA_HOME env was pointing to the JRE HOME instead of the JDK HOME.

On my linux system I had done:

sabayon ~ # eselect java-vm list
Available Java Virtual Machines:
[1]   icedtea-bin-8 
[2]   oracle-jdk-bin-1.8 
[3]   oracle-jre-bin-1.8  system-vm

sabayon ~ # eselect java-vm set system 2

And then Android Studio started like a charm. Download and install the SDK.

Zioalex
  • 3,441
  • 2
  • 33
  • 30
0

After I set JAVA_HOME variable and restart my windows pc I resolved my issue.

JAVA_HOME value should like below.

C:\Program Files\Java\jdk1.8.0_25\bin

I paste a screenshot for someone's help.

enter image description here

You can go here From My Computer / This PC > Property > Advance Variable.

enter image description here

enter image description here

Shihab Uddin
  • 6,699
  • 2
  • 59
  • 74
0

I recently came across this issue while using a Managed Software solution. The company I was working with had Android Studio has part of their managed applications, however, it was a much older version that the latest release. When you use an older version of Android Studio coupled with a newer JDK (I tried 11 and 15) you then receive the error indicating tools.jar cannot be found in CLASSPATH. I resolved this by downloading the latest version from Android Studio's website and it worked like a charm!

Payne Miller
  • 134
  • 1
  • 8
-7

I tried everything I could but it didn't help. So I reinstalled Windows and installed Android Studio and now everything works.

And the irony is, there is no JAVA_HOME or JDK_HOME variable defined but it still works.

Frank Martin
  • 3,147
  • 16
  • 52
  • 73