I am trying to install the 'rJava'
package in my RStudio docker image using my Dockerfile:
FROM rocker/tidyverse:3.6.1
RUN mkdir -p /rstudio
RUN mkdir -p /rscripts
RUN apt-get update && \
apt-get install -y openjdk-11-jdk && \
apt-get install -y liblzma-dev && \
apt-get install -y libbz2-dev
RUN R -e "install.packages(c('rJava','mailR'))"
Following this SO post I added the above part with the apt-get
commands but still I get the same error:
java libs : '-L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm' checking whether Java run-time works... ./configure: line 3766: /usr/bin/java: No such file or directory no configure: error: Java interpreter '/usr/bin/java' does not work ERROR: configuration failed for package ‘rJava’
So there is a missing file or directory but I don't know what changes I should make.
[EDIT 1]:
So, following Dirk's suggestion, I entered in the rstudio container and ran apt-get install r-cran-rjava
which seems to work.
But when I install rJava
package I get a new error:
error: Cannot compile a simple JNI program. Make sure you have Java Development Kit installed and correctly registered in R. If in doubt, re-run "R CMD javareconf" as root.
I tried to enter again in the container and run R CMD javareconf
but that did not change the error. I also tried the following commands found on this article:
sudo apt-get install default-jre
sudo apt-get install default-jdk
But I still get:
Cannot compile a simple JNI program.