Unable to Compile Jni Program Rjava

unable to compile JNI program rJava

The jni.h file is part of JDK installation. You probably don't have Java JDK installed correctly. Download Oracle Java from here, or use your package manager.

If you have Java JDK already installed, set JAVA_HOME environment variable to point to the JDK directory.

Unable to run a simple JNI program error message when installing rJava on R 3.6 for ubuntu bionic beaver

I've investigated with the original poster (we work at the same place) and the problem is that in OpenJDK11 they moved around some of the .so files that the JVM lives in, specifically libjvm.so which in the Ubuntu package is now in /usr/lib/jvm/java-1.11.0-openjdk-amd64/lib/server/.

This means that even if you install the Ubuntu package for rJava with apt install r-cran-rjava it fails when you try to library(rJava).

The solution is to add /usr/lib/jvm/java-1.11.0-openjdk-amd64/lib/server/ to your $LD_LIBRARY_PATH by adding:

export LD_LIBRARY_PATH=/usr/lib/jvm/java-1.11.0-openjdk-amd64/lib/server:$LD_LIBRARY_PATH

to the end of your ~/.bashrc and starting a new shell (or source ~/.bashrc).

This is something we had to fix for our central installs of OpenJDK e.g. here: https://github.com/UCL-RITS/rcps-buildscripts/blob/master/adoptopenjdk-11.0.3_install.sh#L46

If you want to make this work with Rstudio launched from Gnome, you need to add that directory to ldconfig.

As root (or with sudo) create a file in /etc/ld.so.conf.d/ which you should call something with a .conf extension e.g. java.conf which contains the line:

/usr/lib/jvm/java-1.11.0-openjdk-amd64/lib/server

And then as root run

ldconfig -v

This should add the directory to the locations that executables launched through GNOME search for. This particular part of the problem (GNOME ignoring settings in bashrc) has been a problem in Ubuntu since at least 9.04 (https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/366728/).

Cannot compile a simple JNI program on Debian Wheezhy

I had a similar problem while installing xlsx package that has some dependencies
maybe related to java and r java packages...

In order to solve your problem you have to:
- check environment variables $JAVA_HOME and $PATH
- sudo R CMD javareconf

If it doesn't help, try out my configuration with java-7-oracle,

  • install java-7-oracle via webupd8 repository Installing Java 7 (Oracle) in Debian via apt-get

    • set environment variables $JAVA_HOME and $PATH
    • export JAVA_HOME=/usr/lib/jvm/java-7-oracle
    • export PATH=$PATH:$JAVA_HOME/bin
  • sudo update-java-alternatives -s java-7-oracle
  • sudo R CMD javareconf

and than retry the installation of rjava

I hope it will help you!

Unable to install rJava in R 3.0 in Ubuntu 13.04

I ran into the exact same issue. My solution was to install the openjdk-7-* via

sudo apt-get install openjdk-7-*

Followed that with

sudo R CMD javareconf

and I was then able to install rJava in R via install.packages("rJava").

While perhaps not the most elegant solution it appears to have solved my problems with getting rJava to work.

Error:Cannot compile a simple JNI program

Did you make sure you do sudo R CMD javareconf before you do install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-1.1")?



Related Topics



Leave a reply



Submit