A story that solved the problem that the Java (jdk) version was too high to use the h2o library in R and R Studio.

Motivation

If you think you wrote it after a long time, it's about PATH again. For Mac. I'm sorry for Win people. An angry note that solved the problem that the jdk version was caught and the problem did not proceed when the problem of using the deep learning library called h2o in the R environment came out at school.

Solution

Lower the version of jdk used under R environment. The following is a specific method.

What's in Java now?

Launch a terminal instead of the R console and

/usr/libexec/java_home -V

Let's type in and find out. All included Java versions will come out. It's like this. スクリーンショット 2020-01-16 2.32.45.png

Do you have a jdk that can use the h2o library?

The h2o library works with the jdk. At this time, it seems that the lever does not work unless the version of jdk is between 7 and 12. The latest version of jdk is 13! !! !! !! !! !! !! !!

If you don't have the target version of the jdk, get one

If you didn't find the target version when you checked the Java version, download and install it. You can get it from the official website (LTS 11 in the middle instead of 13 that stands out at the top Let's DL).

If you get it, just in case, at the terminal again

/usr/libexec/java_home -V

Please see if you entered properly.

Let's lower the version of jdk

Please be careful here, but the path of jdk used when playing with Java programs in the terminal and the path of jdk referenced by the R environment are different. If you use the following method, the version of jdk used normally will remain 13, and the version of jdk used under the R environment will be 11. You did it.

Search for Renviron files in Finder

Renviron files are like .bash_program in R environment. If you have R (and RStudio) installed, you should have this file. Open it in a suitable editor and even at the bottom

JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home

Let's write.

Done! !!

that's all. The jdk referenced by R is now downgraded. On the R console

python


library(“h2o”)
localH2O = h2o.init(ip = "localhost", port = 54321, startH2O = TRUE, nthreads = -1)

But let's hit it and use h2o. It is said that the version of h2o itself is old, but it can be used.

Thank you for your hard work.

Postscript

The currently distributed LTS11 seems to be 11.0.6 instead of 11.0.2. Please check the version you got and change the PATH each time.

Recommended Posts

A story that solved the problem that the Java (jdk) version was too high to use the h2o library in R and R Studio.
The story of forgetting to close a file in Java and failing
A story about the JDK in the Java 11 era
The operator that was born to be born, instanceof (Java) ~ How to use the instanceof operator ~
Resolved the error that occurred when trying to use Spark in an environment where Java 8 and Java 11 coexist.
How to test a private method in Java and partially mock that method
A story that was embarrassing to give anison file to the production environment
Is it possible to put the library (aar) in the Android library (aar) and use it?
[Java] Use cryptography in the standard library
Java to C and C to Java in Android Studio
The problem that the JDK set in JAVA_HOME does not appear even if java -version is performed at the command prompt
An embarrassing story that was treated as the same day when trying to compare dates on 3/31 and 4/1 [Java / Calendar]
I want you to put the story that the error was solved when you stabbed the charger in the corner of your head
3 ways to import the library in Android Studio
Use the JDK used in Android Studio in the terminal
I want to use PowerMock in a class that combines parameterized tests and ordinary tests
[Java] The problem that true was returned as a result of comparing Integer with ==
I want to use ES2015 in Java too! → (´ ・ ω ・ `)
Java classes and instances to understand in the figure
How to convert A to a and a to A using AND and OR in Java
Try to solve a restricted FizzBuzz problem in Java
The story that .java is also built in Unity 2018
A library that realizes multi-line strings in Java multiline-string
A program (Java) that outputs the sum of odd and even numbers in an array
How to batch initialize arrays in Java that I didn't know when I was a beginner
Filter the Java No. 2 Optional list that was useful in business and get the first value
The story of building a Java version of Minecraft server with GCP (and also set a whitelist)
[Java improvement case] Experience story of learning Java in 2 months and changing jobs to a programmer
A story that I realized that I had to study as an engineer in the first place
I made a program in Java that solves the traveling salesman problem with a genetic algorithm