An open source R package I am planning to use uses RJDBC. When I tried to install RJDBC using
install.packages("RJDBC")
I get an error indicating that rJava is not installed. Tried installing rJava using
install.packages("rJava")
But that resulted in error
checking whether JNI programs can be compiled... configure: error: Cannot compile a simple JNI program. See config.log for details.
Make sure you have Java Development Kit installed and correctly registered in R.
If in doubt, re-run "R CMD javareconf" as root.
ERROR: configuration failed for package ‘rJava’
* removing ‘/home/john/R/x86_64-pc-linux-gnu-library/3.5/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
The downloaded source packages are in
‘/store/tmp/Rtmp0teUWN/downloaded_packages’
Found this SO question and tired almost all the suggestions without luck.
Logged in as root on the server using sudo su
Ran
R CMD javareconf
echo JAVA_HOME printed empty. So used the value from output of R CMD javareconf
ran R CMD javareconf -ed
then from R console ran
install.packages("rJava")
This seems to have installed the package and I assumed this was done for all users. Restarted R studio server
From a new session in R Studio tried to install RJDBC and got error stating rJava is not installed.
Running R CMD javareconf seems to recognize JAVA home paths but installation of rJava as a non-root user fails.
Highly appreciate any leads.