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?

17 Answers 17

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

Sign up to request clarification or add additional context in comments.

4 Comments

It is hackish. Unfortunately it's the only way I got it to work :C
It works perfectly. BUT, every time I update Android Studio it will delete the tools.jar and you have to redo it. Just a forewarning, so bookmark this answer.
It's a hack..helped me after wasting 1 hr for me.
there is only one folder in (Android Studio Root), that is sdk folder. do i need to create new folder called lib inside (Android Studio Root) ??
16

check your JAVA_HOME value!

it should be like this

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

1 Comment

This worked for me, without 'jre' but with the '\'! Also see @Andi answer.
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

Comments

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.

Comments

2

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

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

Comments

1

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

Comments

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.

Comments

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 .

Comments

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.

Comments

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

Comments

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

Comments

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)

Comments

0

1) Just install JDK from here

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

Comments

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.

Comments

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

Comments

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!

Comments

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

2 Comments

You should reconsider marking this as an answer. Reinstalling Windows due to this error seems a bit harsh.
Reinstalling windows is too inappropriate an answer, let alone the right answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.