R: rJava package install failing
Solution 1:
Wouldn't
apt-get install r-cran-rjava
have been easier? You could have asked me at useR! :)
Solution 2:
Turns out my problem was an issue with my JAVA_HOME
environment variable. Yes, shocking I know. My initial setting for PATH
and JAVA_HOME
looked like this:
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export PATH=$PATH:$JAVA_HOME/bin
And I added /jre
so it now looks like this:
export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre
export PATH=$PATH:$JAVA_HOME/bin
Everything in Java seemed to work fine without the /jre
but rJava would not. Odd.
Solution 3:
That is how I make it work :
In Linux (Ubuntu 16.04 and 20.04 worked confirmed)
sudo apt-get install default-jre
sudo apt-get install default-jdk
sudo R CMD javareconf
in R:
install.packages("rJava")