Devon
Devon

Reputation: 680

Python h2o.init() cannot find Java

I'm following the instructions here to setup Python to use H2O.

Despite installing Java in the default location (C:\Program Files\Java), h2o.init() is unable to find Java and exits with ValueError:

Cannot find Java. Please install the latest JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.exe is clearly in C:\Program Files\Java\jdk1.8.0_51\bin.

I can't figure out why h2o.init() is failing. Any ideas?

Upvotes: 3

Views: 10144

Answers (5)

lin Deng
lin Deng

Reputation: 1

Step 1: download the jdk (https://jdk.java.net/archive/)

Step 2: Creat a new folder called "Java" in C://Program Files

Step 3: Unzip your jdk.zip, and put the folder called jdkxxx into Java folder

Step 4: Add the path "C://Program Files//Java" into your environment variable path

Then it willl work.

Upvotes: 0

wordsforthewise
wordsforthewise

Reputation: 15777

I find it easiest to use Anaconda. Install H2O and Java Development Kit (JDK) with conda:

conda install -c conda-forge h2o-py openjdk -y

For me, H2O automatically found this Java version correctly even in my separate conda environment I created for H2O.

Upvotes: 4

Oarabile Hope Moloko
Oarabile Hope Moloko

Reputation: 49

For Ubuntu users, try running this command in the terminal:

sudo apt install default-jre      

Upvotes: 4

Nguyen Phi Vu
Nguyen Phi Vu

Reputation: 11

We need to install both h2o and h2o-py. After install h2o, we'll get h2o.jar inside "C:\Users\admin\Anaconda3\h2o_jar", which is the folder that h2o.init() looks at for h2o.jar.

Upvotes: 1

0xF
0xF

Reputation: 586

You should try to set JAVA_HOME environment variable manually and that might work.Following is the process.

Set JAVA_HOME:

Right click My Computer and select Properties.

On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1.8.0_51

Then go to the h2o directory and run

java -jar h2o.jar

However if still it can't find java then run following command

at C:\Program Files\Java\jdk1.8.0_51

java -jar \path to\h2o.jar

Upvotes: 2

Related Questions