Switch tips for multiple JDK versions under Mac OS X

Source: Internet
Author: User

If you have more than one Java JDK version installed in your system, you may be able to switch back and forth depending on the project or the compilation environment, and there are two very handy ways to choose between them.

I have Java 7 and Java 8 on my machine, and you are modifying it according to your own JDK version.

Method One: in your home directory. Add the following to the Bash_profile file, or create one yourself if the file does not exist.

Export JAVA_HOME_7=/LIBRARY/JAVA/JAVAVIRTUALMACHINES/JDK1. 7. 0_71.jdk/contents/homeexport java_home_8=/library/java/javavirtualmachines/jdk1. 8. 0_51.jdk/contents/homeexport java_home=$JAVA _home_7alias jdk8='Export Java_home= $JAVA _home_8'alias jdk7='export java_home= $JAVA _home_7  '

Method Two:

1.8 ) Export Java_7_home1.7) export Java_home=$JAVA _7_homealias jdk8="  Export java_home= $JAVA _8_home"alias Jdk7="export java_home= $JAVA _7_home "

The second method of personal recommendation. The reason is obvious.

Switch tips for multiple JDK versions under Mac OS X

Related Article

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.