Installing Bazel on Mac OS X, Java 1.8.0 installed, but Installer complains Java cannot be found

1,336 views
Skip to first unread message

philia

unread,
Jan 14, 2016, 3:04:16 AM1/14/16
to bazel-discuss
I followed the instructions on the Bazel installation page (http://bazel.io/docs/install.html), installed Java 1.8.0 and confirmed the XCode version. But when I tried to run ./bazel-0.1.3-installer-darwin-x86_64.sh --user, it gives me the error message "Java not found, please install the corresponding package".

Has anyone had a similar issue? Do I need to update the path for Java?

Damien Martin-guillerez

unread,
Jan 14, 2016, 6:01:35 AM1/14/16
to philia, bazel-discuss
What does `/usr/libexec/java_home -v 1.8+` returns? and `echo "$JAVA_HOME"`?

If those does not point to your java home, you can simply export JAVA_HOME to the good path.
 
On Thu, Jan 14, 2016 at 9:04 AM philia <lisa...@stanford.edu> wrote:
I followed the instructions on the Bazel installation page (http://bazel.io/docs/install.html), installed Java 1.8.0 and confirmed the XCode version. But when I tried to run ./bazel-0.1.3-installer-darwin-x86_64.sh --user, it gives me the error message "Java not found, please install the corresponding package".

Has anyone had a similar issue? Do I need to update the path for Java?

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/04bdca5b-61a2-4cef-9b06-383ff67d7d87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

lisa...@stanford.edu

unread,
Jan 14, 2016, 6:15:39 AM1/14/16
to bazel-discuss, lisa...@stanford.edu
'export JAVA_HOME' fixed it. Thanks a lot!

tch...@gmail.com

unread,
Apr 24, 2016, 12:12:39 PM4/24/16
to bazel-discuss, lisa...@stanford.edu
On Thursday, January 14, 2016 at 12:04:16 AM UTC-8, philia wrote:
> I followed the instructions on the Bazel installation page (http://bazel.io/docs/install.html), installed Java 1.8.0 and confirmed the XCode version. But when I tried to run ./bazel-0.1.3-installer-darwin-x86_64.sh --user, it gives me the error message "Java not found, please install the corresponding package".
>
> Has anyone had a similar issue? Do I need to update the path for Java?

I encountered the same issue and here is my fix

Add this to your ~/.bashrc file and source it before running compile.sh
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/"

Note I searched for this issue and somewhere else it was telling me to do this.
export JAVA_HOME='/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home'

Even thought this will make " java -version" returns 1.8 there is no javac under this directory and also the space in the directory name will break the compile.sh script.

So use the first JAVA_HOME without the space in the directory name.

Reply all
Reply to author
Forward
0 new messages