MAC OS X10下 JAVA的环境变量设置
参看: http://www.baeldung.com/java-home-on-windows-7-8-10-mac-os-x-linux
From OS X 10.5, Apple introduced a command line tool (/usr/libexec/java_home) which dynamically finds the top Java version specified in Java Preferences for the current user.
Open ~/.bash_profile in any text editor and add:
1
|
export JAVA_HOME=$( /usr/libexec/java_home ) |
Save and close the file.
Open a Terminal and run the source command to apply the changes:
1
|
source ~/.bash_profile |
Now we can check the value of the JAVA_HOME variable:
1
|
echo $JAVA_HOME |
The result should be the path to the JDK installation:
1
|
/Library/Java/JavaVirtualMachines/jdk1 .8.0_111.jdk /Contents/Home |
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步