none
Error in installing rJava package RRS feed

  • Question

  • I recently set up a Ubuntu 16.04 VM and installed Microsoft R Server together with a couple of Ubuntu packages (e.g. openjdk-8-jdk and r-cran-rjava) on it. I encountered a problem when installing rJava package. The error message that I got was

    checking Java support in R... configure: error: absent
    R was configured without Java support. Please run
    R CMD javareconf
    as root to add Java support to R.

    Then, I ran the R CMD javareconf as the root (see output below), but still got the same error message saying R was configured without Java support.

    Java interpreter : /usr/lib/jvm/default-java/jre/bin/java
    Java version     : 1.8.0_131
    Java home path   : /usr/lib/jvm/default-java
    Java compiler    : /usr/lib/jvm/default-java/bin/javac
    Java headers gen.: /usr/lib/jvm/default-java/bin/javah
    Java archive tool: /usr/lib/jvm/default-java/bin/jar

    trying to compile and link a JNI program
    detected JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
    detected JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux     -fpic  -g -O2 -fstack
    -protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c conftest.c -o conftest.o
    gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.so conftest.o -L/usr/lib/jvm/default-java/jre/lib/amd64/serv
    er -ljvm -L/usr/lib/R/lib -lR

    JAVA_HOME        : /usr/lib/jvm/default-java
    Java library path: $(JAVA_HOME)/jre/lib/amd64/server
    JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
    JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
    Updating Java configuration in /usr/lib/R
    Done.

    I then installed R (i.e. r-base package) onto the VM and found that I was able to install rJava package in R. How come I couldn't install rJava package in Microsoft R Server? Could anyone please shed some light on this? Thank you.

    Here are some settings of the VM

    felix@Shiny01:~$ echo $JAVA_HOME

    felix@Shiny01:~$ echo $LD_LIBRARY_PATH
    /usr/lib/oracle/12.2/client64/lib
    felix@Shiny01:~$ echo $PATH
    /usr/lib/oracle/12.2/client64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
    felix@Shiny01:~$ sudo update-alternatives --config java
    There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
    Nothing to configure.




    Friday, June 2, 2017 7:08 AM