build openjdk on mac "JAVA_HOME is not defined correctly"
Asked Answered
D

1

11

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.

Deliquesce answered 5/4, 2015 at 10:0 Comment(3)
As far i know, java home should be /1.7.0.jdk, not /1.7.0.jdk/Contents/HomeDaedalus
#6588890Bipetalous
thanks for your answers. I am trying to build a JVM based on previous idk so the BOOTDIR should be the path of the previous JDK. And in my opinion, the important thing is not the JAVA_HOME which must be unset.Deliquesce
E
11

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

Etching answered 5/4, 2015 at 11:18 Comment(2)
I think you'll find java and javac should generally be symlinked from /usr/binSchuh
The latest Brew API requires brew install --cask adoptopenjdk11Lomax

© 2022 - 2024 — McMap. All rights reserved.