java environment variable configuration under mac

1. Find the soft connection location of the java command through which java  

which java  位置在/usr/bin/java

2, find the link address through ls -l java 

/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

 

Environment variable configuration

 

cd  ~touch.bash_profile

you .bash_profile

enter

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home

 

export PATH=$JAVA_HOME/bin:$PATH

 

Note: The above path is your jdk installation path, you can modify it reasonably.

After entering the edit content, press the esc key in the input mode, and enter the save and exit command:

:wq

Update configuration file:

source .bash_profile

 Restart the terminal and use java -version to check whether it takes effect.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326798944&siteId=291194637