Shailesh
Shailesh

Reputation: 403

Unable to install rJava on R platform

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

Upvotes: 1

Views: 1027

Answers (2)

Mstatili Sol
Mstatili Sol

Reputation: 1

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")

Upvotes: 0

Verena Praher
Verena Praher

Reputation: 1272

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).

Upvotes: 0

Related Questions