The MAC system installs java and configures environment variables
- 2021-12-05 07:35:02
- OfStack
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 JDK environment variable content and enter wq to save
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home #jdk Installation path
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
4. Update the configuration file
source .bash_profile
5. View the environment variable JDK version
java -version
Thank you for reading, hope to help everyone, thank you for your support to this site!