"Java" MAC configuration JAVA environment variables

Source: Internet
Author: User

If you use bash, modify ~/.bash_profile or~/.profile;

If you use zsh, modify the ~/.ZSHRC

After modifying these files, re-open terminal, the configuration will not be lost

First make sure the JDK is installed:

# # Check the present running Javawhich java## check Java versionjava-version

Take zsh as an example:
# # Check all the available JDK 2/usr/libexec/java_home-v 3  4 # # Check the top JDK 5/usr/libexec/java_home 6  7 # # Check some jdk (eg. version 1.7) 8/usr/libexec/java_home-v 1.7 9 # # Edit. ZSHRC to set Java_home variable11 vim ~/. ZSHRC12 # # Add the following line into the FILE14 export java_home=$ (/usr/libexec/java_home) # # # You can also use T He following line to set the variable, which are not recommended, only for older Mac os.17 # # Export JAVA_HOME=/SYSTEM/LIBR Ary/java/javavirtualmachines/1.6.0.jdk/contents/home18 # #let the configuration in. ZSHRC take effect20 source ~/. ZSHRC21 # # # Check if configure Succeed23 echo $JAVA _home

"Java" MAC configuration JAVA environment variables

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.