1

I have Ubuntu 10.x OS and I have installed R on it. I want to install rJava on R. For that when I am running installed.packages("rJava) command which is giving error

checking whether Java run-time works... Error: Could not find or load main class getsp no configure: error: Java interpreter '/usr/bin/java' does not work ERROR: configuration failed for package ‘rJava’ * removing ‘/home/hduser/R/i486-pc-linux-gnu-library/2.10/rJava’

The downloaded packages are in ‘/tmp/Rtmp0tlBXn/downloaded_packages’ Warning message: In install.packages("rJava") : installation of package 'rJava' had non-zero exit status

If I run system("java -version")

Then it showing same Java version which is given when I run Java -version command from base OS prompt. So it means no problem with Java which I can see reason in output of install package command? As suggested when I use

 sudo apt-get install r-cran-rjava

Here also didnt get any luck Please suggest

Shailesh
  • 405
  • 1
  • 5
  • 18
  • You should add why apt-get doesn't work. What is the error message? – Verena Haunschmid Feb 16 '15 at 09:28
  • There are already some posts http://stackoverflow.com/questions/7129303/cant-install-rjava-0-9-on-ubuntu-10-04?rq=1 and http://stackoverflow.com/questions/3311940/r-rjava-package-install-failing?rq=1 – Verena Haunschmid Feb 16 '15 at 09:29
  • @ExpectoPatronum 'sudo apt-get install r-cran-rjava' command now is saying 'r-cran-rjava is already the newest version.'. But I am not getting rJava in package list on R prompt. Before it was there in the list. Installed.package() method now giving different error. See following ' Package LibPath Version Priority Bundle Contains Depends Imports LinkingTo Suggests Enhances OS_type License Built Warning message: In list.files(lib) : list.files: 'rJava' is not a readable directory ' – Shailesh Feb 16 '15 at 12:09

2 Answers2

0

I just saw that you wrote installed.packages instead of install.packages, you have to use install.packages("rJava") to install it.

The description of the method you used (installed.packages) says: Find (or retrieve) details of all packages installed in the specified libraries.

Can you please try

install.packages("rJava")
library(rJava)

and tell me the output? (I'm pretty sure it will already work then).

Verena Haunschmid
  • 1,252
  • 15
  • 40
0

in the terminal run sudo apt-get install default-jdk

then run sudo R CMD javareconf

after that you can continue in R or Rstudio install.packages("rJava")