[英]How to Set Java JDK Environment Variable for Mac OS X 10.8 Mountain Lion
Can anybody tell me how to set environment variable for Mac OS X 10.8 Mountain Lion. 谁能告诉我如何为Mac OS X 10.8 Mountain Lion设置环境变量。 I just upgrade my Mac to Mac OS X 10.8. 我只是将我的Mac升级到Mac OS X 10.8。 When I run a script. 当我运行脚本时。 It said that 它说
"/Users/ruijiaoli/lejos_nxj/bin/nxj: line 64: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java: No such file or directory" “/ Users / ruijiaoli / lejos_nxj / bin / nxj:第64行:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java:没有这样的文件或目录”
I found that JDK in the directory within the path above. 我发现JDK在上面路径的目录中。 And it worked well in Mac OS X lion. 它在Mac OS X Lion中运行良好。 Is the JDK path changed in Mac OS X mountain Lion? Mac OS X Mountain Lion中的JDK路径是否已更改? The version of Java on my system is 1.6. 我系统上的Java版本是1.6。
This is what I have tried: 这是我尝试过的:
create the bash_profile: 创建bash_profile:
$ vim ~/.bash_profile
add this to the file: 将其添加到文件中:
export JAVA_HOME=$(/usr/libexec/java_home)
execute the source command 执行source命令
$ source ~/.bash_profile
echo JAVA_HOME: echo JAVA_HOME:
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home
I created a file ~/.bash_profile and added: 我创建了一个文件〜/ .bash_profile并添加了:
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... 而且一切都对我有用......
浏览arround我发现这个链接你可以按照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/ 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+) 它解释了如何为单个用户或系统范围设置路径(OS X Leopard +)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.