Multiple JDK configurations in Mac OS (reprint +)

Source: Internet
Author: User
Tags switches

1. Install all the JDK first:

* Mac comes with JDK6, installed in directory:/system/library/java/javavirtualmachines/1.6.0.jdk/.

* Jdk7,jdk8 will need to download and install the corresponding version on the Oracle website. The default path for your own JDK installation is:/LIBRARY/JAVA/JAVAVIRTUALMACHINES/JDK1.8.0.JDK

2. Configuration

Create a. Bash_profile configuration file (Skip this step if you already have the file)

Touch ~/.bash_profile

#vim编辑. bash_profile file

Vim ~/.bash_profile

#如果不习惯vim命令就使用自带的文本编辑器打开

Open ~/.bash_profile

Set JDK version

 

 

 export   java_6_home=/system/library/java/javavirtualmachines/1.6.0.jdk/contents/home

 export   java_7_home=/ Library/java/javavirtualmachines/jdk1.7.0.jdk/contents/home

  Export   java_8_home=/library/java/javavirtualmachines/ Jdk1.8.0.jdk/contents/home

 

export   java_home= $JAVA _6_home

Alias command dynamically switches the configuration of Java_home

alias jdk8= ' export java_home= $JAVA _8_home '

alias jdk7= ' export java_home= $JAVA _7_home '

alias jdk6= ' export java_home= $JAVA _6_home '

#输入完成后保存执行下面命令

#重新执行. bash_profile file

Source ~/.bash_profile

3. Verification:

Use: Jdk6, JDK7, jdk8 to switch JDK versions

1. Install all the JDK first:

* Mac comes with JDK6, installed in directory:/system/library/java/javavirtualmachines/1.6.0.jdk/.

* Jdk7,jdk8 will need to download and install the corresponding version on the Oracle website. The default path for your own JDK installation is:/LIBRARY/JAVA/JAVAVIRTUALMACHINES/JDK1.8.0.JDK

2. Configuration

Create a. Bash_profile configuration file (Skip this step if you already have the file)

1

Touch ~/.bash_profile

#vim编辑. bash_profile file

Vim ~/.bash_profile

#如果不习惯vim命令就使用自带的文本编辑器打开

Open ~/.bash_profile

Set JDK version

 

 

 export   java_6_home=/system/library/java/javavirtualmachines/1.6.0.jdk/contents/home

 export   java_7_home=/ Library/java/javavirtualmachines/jdk1.7.0.jdk/contents/home

  Export   java_8_home=/library/java/javavirtualmachines/ Jdk1.8.0.jdk/contents/home

 

export   java_home= $JAVA _6_home

Alias command dynamically switches the configuration of Java_home

alias jdk8= ' export java_home= $JAVA _8_home '

alias jdk7= ' export java_home= $JAVA _7_home '

alias jdk6= ' export java_home= $JAVA _6_home '

#输入完成后保存执行下面命令

#重新执行. bash_profile file

1

Source ~/.bash_profile

3. Verification:

Use: Jdk6, JDK7, jdk8 to switch JDK versions

Multiple JDK configurations in Mac OS (reprint +)

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.