build openjdk on mac “JAVA_HOME is not defined correctly”

梦想的初衷 提交于 2019-12-11 01:52:20

问题


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

the OS of my mac is 10.10.2.

the openjdk is

openjdk-7u40-fcs-src-b43-26_aug_2013

the ALT_BOOTDIR

export ALT_BOOTDIR=/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home

the $JAVA_HOME

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

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.

any ideas?

thinks.


回答1:


Before setting the path make sure that java is installed by checking the directory

/Library/Java/JavaVirtualMachines/<version>.jdk/Contents/Home

Then in .bashrc or .bash_profile

JAVA_HOME=/Library/Java/JavaVirtualMachines/<version>.jdk/Contents/Home
export JAVA_HOME

If it OpenJDK is missing you can install it through brew

brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk8

There should be symlinks in /usr/bin to java and javac



来源:https://stackoverflow.com/questions/29456149/build-openjdk-on-mac-java-home-is-not-defined-correctly

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