<code>Error: JAVA_HOME is not defined correctly. We cannot execute /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java </code>
我已将OSX升级到10.8.4.在OSX升级之后,我已将JDK和JRE升级到7.但是当我尝试maven构建项目时,我收到了上述错误.
当我运行ls -al /System/Library/Frameworks/JavaVM.framework/Versions/
我收到以下回复
<code>drwxr-xr-x 11 root wheel 374 Jul 22 22:33 . drwxr-xr-x 10 root wheel 340 Jul 22 18:30 .. lrwxr-xr-x 1 root wheel 10 Jul 22 18:30 1.4 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 Jul 22 18:30 1.4.2 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 Jul 22 18:30 1.5 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 Jul 22 18:30 1.5.0 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 Jul 22 18:30 1.6 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 Jul 22 18:30 1.6.0 -> CurrentJDK drwxr-xr-x 7 root wheel 238 Jul 22 18:30 A lrwxr-xr-x 1 root wheel 1 Jul 22 18:30 Current -> A lrwxr-xr-x 1 root wheel 59 Jul 22 18:30 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents </code>
对于这个ls -al /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin
我没有进一步看到CurrentJDK中的任何内容.
在运行/usr/libexec / java_home时
我明白了:
<code>/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home </code>
我对使用OS X非常陌生.请告诉我,如果我仍然错过了使其成功的任何一点.
解决方法:
Apple建议将JAVA_HOME设置为“/usr/libexec / java_home”.
对我有用的是围绕$()包装.所以我最终使用以下命令配置JAVA_HOME,如$(/usr/libexec / java_home):
<code>vim ~/.bash_profile export JAVA_HOME=$(/usr/libexec/java_home) source ~/.bash_profile </code>
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!