The JDK version on Mac is 1.8, and JDK 1.7 is found when compiling AOSP. Looking for a more easy way to switch the JDK version, after Google found jenv more appropriate.
There are at least three ways of installing jenv:
-$ git clone https://github.com/gcuisinier/jenv.git ~/.jenv
-$ curl-l-S Get.jenv.io | Bash
-$ brew Install jenv
I installed it in a third way.
Run after installation
Jenv Doctor
Two errors were reported.
1. Similar to:
Jenv is not loaded in your $shell "
To fix: \tcat eval "$ (jenv init-)" >> ' $profile
Description missing the appropriate configuration in. bash_profile.
$ Echo ' Export path= ' $HOME/.jenv/bin: $PATH "' >> ~/.bash_profile
$ Echo ' eval ' $ (jenv init-) "' >> ~/.bash_profile
Write the configuration directly to fix this error;
2. Similar to:
Java binary in path was not in the jenv shims.
Please check your path, or try using ' jenv add/path/to/java/home '.
Find the location of the JDK under Mac (/library/java/javavirtualmachine/jdk1.7.0_79.jdk/contents/home) and run jenv add join.
Jenv Doctor returns all correct after the next action. You can switch versions freely by running a command similar to JENV global JDK1.7.0_79.JDK.
Reference:
-[Github] (https://github.com/gcuisinier/jenv)
-[jenv] (http://jenv.io/)
Configure different versions of the JDK on your Mac