tools.jar seems to be not in Android Studio classpath on Windows 8

∥☆過路亽.° 提交于 2019-12-28 05:17:13

问题


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?


回答1:


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




回答2:


check your JAVA_HOME value!

it should be like this

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




回答3:


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



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




回答5:


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

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




回答6:


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




回答7:


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.




回答8:


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 .




回答9:


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.




回答10:


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




回答11:


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




回答12:


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)




回答13:


1) Just install JDK from here

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




回答14:


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.




回答15:


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.



来源:https://stackoverflow.com/questions/27528652/tools-jar-seems-to-be-not-in-android-studio-classpath-on-windows-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!