Home  >  Article  >  Java  >  Detailed explanation of installing Java and configuring environment variables on MAC system

Detailed explanation of installing Java and configuring environment variables on MAC system

黄舟
黄舟Original
2017-03-22 10:13:491665browse

This article mainly introduces the relevant information on installing java and configuring environment variables on MAC system. Friends in need can refer to

MAC Configuring java environment variables

1. List all Java version information

/usr/libexec/java_home -V

2. Modify the .bash_profile file

cd ~

touch .bash_profile

vi .bash_profile

3. Configure the JDK environment variable content and enter wq to save

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home #jdk安装路径  
export PATH=$JAVA_HOME/bin:$PATH 
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

4.UpdateConfiguration file

source .bash_profile

5. Check the environment variable JDK version

java -version

The above is the detailed content of Detailed explanation of installing Java and configuring environment variables on MAC system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn