Configure different versions of the JDK on your Mac

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.