# Error: No rule to make target 'jni.h', needed by 'build/NativeBoot.o'

**URL:** <https://discuss.hail.is/t/error-no-rule-to-make-target-jni-h-needed-by-build-nativeboot-o/2518>\
**Category:** Hail Query & hailctl\
**Created:** [February 22, 2022, 9:37am UTC](https://discuss.hail.is/t/error-no-rule-to-make-target-jni-h-needed-by-build-nativeboot-o/2518 "2022-02-22T09:37:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/abhishek/32/570_2.png) [@Abhishek](https://discuss.hail.is/u/Abhishek)\
**Post date:** [February 22, 2022, 9:37am UTC](https://discuss.hail.is/t/error-no-rule-to-make-target-jni-h-needed-by-build-nativeboot-o/2518/1 "2022-02-22T09:37:23Z")

</div>

Getting error while installing hail on cluster

I have set my `JAVA_HOME` as

> export JAVA\_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/

Installation steps:

```python
apt-get update -y
apt-get install \
    openjdk-8-jdk-headless \
    g++ \
    python3 python3-pip \
    libopenblas-dev liblapack-dev \
    liblz4-dev -y

git clone https://github.com/hail-is/hail.git
cd hail && git checkout 0.2.72 && cd hail
make install-on-cluster HAIL_COMPILE_NATIVES=1 SCALA_VERSION=2.12.13 SPARK_VERSION=3.2.0

```

Error trace:

```python
2022-02-22 01:17:47 make[1]: Leaving directory '/home/dnanexus/hail/hail/src/main/c'
2022-02-22 01:17:47 make[1]: *** No rule to make target 'jni.h', needed by 'build/NativeBoot.o'. Stop.
2022-02-22 01:17:47 make: *** [Makefile:374: native-lib-prebuilt] Error 2

```

PS: I did checkout this thread: [Link](https://discuss.hail.is/t/hail-0-2-building-from-source-fails-on-aws-emr-no-rule-to-make-target-jni-h/1199)

---

<div class="post-metadata">

**Author:** ![Abhishek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/abhishek/32/570_2.png) [@Abhishek](https://discuss.hail.is/u/Abhishek)\
**Post date:** [February 22, 2022, 12:20pm UTC](https://discuss.hail.is/t/error-no-rule-to-make-target-jni-h-needed-by-build-nativeboot-o/2518/2 "2022-02-22T12:20:01Z")

</div>

Context: I am creating a custom spark cluster on DNANexus RAP.

---

<div class="post-metadata">

**Author:** ![johnc1231](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/johnc1231/32/286_2.png) [@johnc1231](https://discuss.hail.is/u/johnc1231)\
**Post date:** [February 22, 2022, 1:32pm UTC](https://discuss.hail.is/t/error-no-rule-to-make-target-jni-h-needed-by-build-nativeboot-o/2518/3 "2022-02-22T13:32:59Z")

</div>

Hi Abhishek,

Pretty sure your problem is that you have `JAVA_HOME` set incorrectly. It needs to point to the “jdk” (Java Development Kit), not the “jre” (Java Runtime Environment).

---

<div class="post-metadata">

**Author:** ![Abhishek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/abhishek/32/570_2.png) [@Abhishek](https://discuss.hail.is/u/Abhishek)\
**Post date:** [February 23, 2022, 3:55pm UTC](https://discuss.hail.is/t/error-no-rule-to-make-target-jni-h-needed-by-build-nativeboot-o/2518/4 "2022-02-23T15:55:10Z")

</div>

Yes, I found that my JAVA\_HOME was not correctly set because I only installed jre.  
So, I added the steps mentioned in hail documentation

```auto
apt-get update -y
apt-get install \
    openjdk-8-jdk-headless \
    g++ \
    python3 python3-pip \
    libopenblas-dev liblapack-dev \
    liblz4-dev \
    rsync -y

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

HAIL_VERSION=0.2.78

# Build Hail
# Following https://hail.is/docs/0.2/install/other-cluster.html
mkdir -p /builds
cd /builds
git clone https://github.com/hail-is/hail.git
cd hail/hail
git checkout $HAIL_VERSION

make install-on-cluster HAIL_COMPILE_NATIVES=1 SCALA_VERSION=2.11.12 SPARK_VERSION=2.4.4 HAIL_PYTHON3=python3

```

Earlier my `JAVA_HOME` was set to  
`export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre`

I had to reset it to `export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64`.

---

<div class="post-metadata">

**Author:** ![poneill](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/poneill/32/964_2.png) [@poneill](https://discuss.hail.is/u/poneill)\
**Post date:** [May 2, 2023, 7:37pm UTC](https://discuss.hail.is/t/error-no-rule-to-make-target-jni-h-needed-by-build-nativeboot-o/2518/5 "2023-05-02T19:37:50Z")

</div>

Hi all,

I got snagged by this too. NB that the 0.2 dev installation instructions ([Hail | For Software Developers](https://hail.is/docs/0.2/getting_started_developing.html)) refer you to the installation requirements for the end-user installation ([Hail | Install Hail on GNU/Linux](https://hail.is/docs/0.2/install/linux.html)), which have you install openjdk-8-jre-headless, but apparently not the JDK per se. In that case, it seems that the path /usr/lib/jvm/java-8-openjdk-amd64 is present but exporting it as JAVA\_HOME doesn’t suffice to install.

In any case, I was able to resolve it with:

sudo apt-get install openjdk-11-jdk  
export JAVA\_HOME=/usr/lib/jvm/java-11-openjdk-amd64

The docs might benefit from including language to that effect.

Thanks!

---

<div class="post-metadata">

**Author:** ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)\
**Post date:** [May 2, 2023, 8:54pm UTC](https://discuss.hail.is/t/error-no-rule-to-make-target-jni-h-needed-by-build-nativeboot-o/2518/6 "2023-05-02T20:54:05Z")

</div>

Thanks for the report! The next release of the docs will [clarify the need for the JDK](https://github.com/hail-is/hail/pull/12968).
