mac os 里的 JAVA_HOME

$ cat ~/.profile  
JAVA_HOME=`/usr/libexec/java_home`  
export JAVA_HOME  
$ echo $JAVA_HOME  
/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home  

另外可以使用-V选项列出所有版本的JAVA_HOME:

$ /usr/libexec/java_home -V  
Matching Java Virtual Machines (3):  
    1.7.0_45, x86_64:   "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home  
    1.6.0_65-b14-462, x86_64:   "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home  
    1.6.0_65-b14-462, i386: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home  
    /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home 

posted on 2017-12-03 21:30  cag2050  阅读(171)  评论(0编辑  收藏  举报

导航