在Mac上构建openjdk“未正确定义JAVA_HOME"; [英] build openjdk on mac "JAVA_HOME is not defined correctly"
本文介绍了在Mac上构建openjdk“未正确定义JAVA_HOME";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在MAC上构建openjdk并遇到这样的问题:
I am building openjdk on MAC and facing a problem like this:
Error: JAVA_HOME is not defined correctly.
We cannot execute /NO_BOOTDIR/bin/java
我的Mac的操作系统是10.10.2.
the OS of my mac is 10.10.2.
openjdk是
openjdk-7u40-fcs-src-b43-26_aug_2013
ALT_BOOTDIR
the ALT_BOOTDIR
export ALT_BOOTDIR=/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home
$ JAVA_HOME
the $JAVA_HOME
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home
当我设置JAVA_HOME并运行"make sanity"时,错误是这样的:
when I set JAVA_HOME and run 'make sanity', the error is like this:
ERROR: Your JAVA_HOME environment variable is set. This will
most likely cause the build to fail. Please unset it
and start your build again.
所以我必须取消设置,无论是否取消设置,都会出现错误.
so I have to unset it and no matter I unset it or not, the error appears.
有什么想法吗?
思考.
推荐答案
在设置路径之前,请通过检查目录
Before setting the path make sure that java is installed by checking the directory
/Library/Java/JavaVirtualMachines/<version>.jdk/Contents/Home
然后在.bashrc
或.bash_profile
JAVA_HOME=/Library/Java/JavaVirtualMachines/<version>.jdk/Contents/Home
export JAVA_HOME
如果缺少OpenJDK,则可以通过酿造
If it OpenJDK is missing you can install it through brew
brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk8
在/usr/bin
到java
和javac
这篇关于在Mac上构建openjdk“未正确定义JAVA_HOME";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文