h2o was working before on my laptop, but I didn't use it for a while
(and have installed new packages and updated things in the meantime). Yesterday I tried using it, but it didn't work. I erased the R h2o packaged and I've reinstalled h2o from scratch with
install.packages("h2o")
I tried running h2o with h2o.init() but it gives me this error
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
Starting H2O JVM and connecting: ............................................................
[1] "localhost"
[1] 54321
[1] TRUE
[1] -1
[1] "Failed to connect to localhost port 54321: Connection refused"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 54321: Connection refused
[1] 7
Error in h2o.init() : H2O failed to start, stopping execution.
When I look at the error log it shows
Only Java 1.6-1.8 supported, version is 9
I tried to look for more info and I think the error is triggered by this code on line 1836:
if (version != null && !(version.startsWith("1.6") || version.startsWith("1.7") || version.startsWith("1.8"))) {
System.err.println("Only Java 1.6-1.8 supported, version is " + version);
return true;
So it seems h2o is checking for a version that starts with 1.6, 1.7 and 1.8 but my version for some reason starts with 9!
However, on the terminal, java -version gives
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (Zulu 8.20.0.5-macosx) (build 1.8.0_121-b15)
OpenJDK 64-Bit Server VM (Zulu 8.20.0.5-macosx) (build 25.121-b15, mixed mode)
and which java gives
/Users/myusername/anaconda3/bin/java
------------ EDIT -------
More info: /usr/libexec/java_home -V gives
Matching Java Virtual Machines (4):
9, x86_64: "Java SE 9" /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home
1.8.0_144, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
1.8.0_51, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home
1.8.0_25, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
Which explains the 9 that h2o is seeing. I find it weird that it expects 1.x.0 but the version is just 9. In any case, it seems I need to point that h2o.init() command to the 1.8 java, but I couldn't figure out how to do it.
I usually use brew to install most things, but I never use java so I don't know anything about the versions.
Thanks and best!