How to Set Java JDK Environment Variable for Mac OS X 10.8 Mountain Lion

谁说胖子不能爱 提交于 2019-11-27 19:52:49

This is what I have tried:

create the bash_profile:

$ vim ~/.bash_profile 

add this to the file:

export JAVA_HOME=$(/usr/libexec/java_home)

execute the source command

$ source ~/.bash_profile

echo JAVA_HOME:

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home

I created a file ~/.bash_profile and added:

export PATH=/usr/local/mysql/bin:$PATH
export PATH=/Users/sparkyspider/dev/javalibs/Grails/grails-2.1.1/bin:$PATH
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home

And all's working great for me...

browsing arround I found this link you can follow, with instructions from oracle http://docs.oracle.com/cd/E19509-01/820-3208/6neopagg5/index.html

I've found the following post very helpful -

http://www.cyberciti.biz/faq/appleosx-bash-unix-change-set-path-environment-variable/

It explains how to set the path for a single user or system wide (OS X Leopard+)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!