I looked at the stack overflow and could not find a solution to my problem. It is a little longer, but I did not find a solution last week, searching non-stop.
Problem: tools.jar not found when trying to compile Android source code, and also when trying to install Android Studio
Operating system: Mac OS X El Capitan 10.11 Computer: MacBook Pro Retina, end of 2015. (A new computer a couple of weeks ago)
Here are two scenarios that seem to have the same problem.
Scenario 1: I'm trying to compile the Android source code to create a custom ROM. I followed the steps of http://source.android.com for OS X, specifically the http://source.android.com/source/initializing.html in the MAC section.
I have completed all the steps leading to the creation of the system. Next step
source build/envsetup.sh lunch aosp_eng
This error appears @lunch aosp_eng:
*** Error: could not find jdk tools.jar at /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/../lib/tools.jar, please check if your JDK was installed correctly. Stop. ** Don't have a product spec for: 'aosp_arm' ** Do you have the right repo manifest?
Scenario 2. Download Android Studio to create the application, but this error appears,
'tools.jar' seems to be not in Studio classpath. Please ensure JAVA_HOME points to JDK rather than JRE.
This is my .bash_profile:
export PATH=/usr/local/opt/mongodb/bin/:$PATH
The first line for Mongodb, "mounts", is the step-by-step process of source.android.com. Use ccache from a combination of the android tutorial and using MacPorts to be able to use ccache. All JAVA_HOME that have been commented out, I'm trying to find a solution on the Internet.
I currently have several versions of the java version installed
jdk1.7.0_71.jdk jdk1.7.0_79.jdk jdk1.8.0_65.jdk jdk1.9.0jdk
JDK 1.9 is a beta version, but I needed to install Netbeans Dev JDK 1.9, as there is a known bug with MacBook Pro Retina with Netbeans 1.8. The laggy scroll and the only current fix is ββthe JDK beta.
Depending on which of the $ JAVA_HOME I am using, this produces:
me-mbp:~ Me$ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/ me-mbp:~ Me$ javac -version java 1.8.0_65 me-mbp:~ Me$ which java /usr/bin/java
If I comment on all $ JAVA_HOME, by default it will be jdk1.9. I donβt know why, but it is.
Any semblance of a solution arose when I copied tools.jar to the Android Studio App folder (see below). This allowed me to βinstallβ Android Studio and run, but as soon as I tried to create a new application, it just sat there and did nothing. In addition, Studio had an error: "Using jdk1.9" must be changed in the settings (rephrased).
cp /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/lib/tools.jar /Volumes/Macintosh\ HD/Applications/Android\ Studio.app/Contents/lib/
A solution to the problem would be a godsend. Most of my work depends on this, and I would like to be able to from my new laptop. At the moment, I need to get away from the Ubuntu machine in order to complete all my work with Android. The problem with Android Studio was just an extension of the problem (I think). Thanks in advance.