MAC OS X10下 JAVA的环境变量设置

本文介绍了如何在MacOS系统中设置Java环境变量。通过使用命令行工具java_home,可以找到当前用户首选的Java版本,并将其路径设置为JAVA_HOME环境变量。具体步骤包括编辑.bash_profile文件、运行source命令应用更改,最后验证JAVA_HOME变量是否正确设置。

参看: 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

转载于:https://www.cnblogs.com/carol-wei/p/7836699.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值