Not able to install rJava in R (ubuntu 18.04)
On my clean installation of Ubuntu 18.04 LTS I did the following
sudo apt-get install r-base-dev default-jdk
(so I have R 3.4 from official repository).
Then in R
or in RStudio 1.1.456 session:
install.packages('rJava')
and it ended with
* DONE (rJava)
Note: I'm using default OpenJDK 11 from Bionic repository -
$ update-java-alternatives -l
java-1.11.0-openjdk-amd64 1101 /usr/lib/jvm/java-1.11.0-openjdk-amd64
In my case, I also had to use: sudo R CMD javareconf
, to make it work.
Running Ubuntu 18.04 64-bit, R 3.60, and RStudio 1.2.1335.
In my case, I had to do the following:
(Temporarily) disable Oracle Java 8 by renaming jdk.csh and jdk.sh to jdk.csh.old and jdk.sh.old (in etc/profile.d).
Install java-11-openjdk.
Add JAVA_HOME="/usr/lib/jvm/java-11-openjdk" to /etc/environment.
Run "sudo update-alternatives --config java" and select "/usr/lib/jvm/java-11-openjdk-amd64.bin/java".
Run "sudo R CMD javareconf".
Logout/login.
Open RStudio and install rJava.
rJava then installed with no errors.