Wednesday, February 4, 2015

rJava Package Not Installing on Mint Linux 17

I ran into a problem while trying to install the xlsx package.

After running

 install.packages("xlsx")

 I got the following


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/hiro/R/x86_64-pc-linux-gnu-library/3.1/rJava’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status
ERROR: dependency ‘rJava’ is not available for package ‘xlsxjars’
* removing ‘/home/hiro/R/x86_64-pc-linux-gnu-library/3.1/xlsxjars’
Warning in install.packages :
  installation of package ‘xlsxjars’ had non-zero exit status
ERROR: dependencies ‘rJava’, ‘xlsxjars’ are not available for package ‘xlsx’
* removing ‘/home/hiro/R/x86_64-pc-linux-gnu-library/3.1/xlsx’
Warning in install.packages :
  installation of package ‘xlsx’ had non-zero exit status


Then I ran the suggested line as root
    sudo R CMD javareconf" as root

It came back without anything strange.


Then I tried to install the rJava package

    > install.packages("rJava") 

I got two errors

    /usr/bin/ld: cannot find -lpcre
    /usr/bin/ld: cannot find -lbz2

After searching I found the problem was two missing libraries which can be installed with
    sudo apt-get install libpcre3-dev
    sudo apt-get install libbz-dev
I had to close and open R Studio after all these steps.

Hope this helps someone else!