2

I am running Ubuntu 18.04 on an AWS EC2 instance and I am having trouble loading the rJava package when I run the script from the console or within a base-r (v 3.4.4) session.

The package loads fine within RStudio-server via the browser with no errors but if I run it from the console or within base-r (typing R in the console) I get the following error:

Error: package or namespace load failed for ‘mailR’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/home/ubuntu/R/x86_64-pc-linux-gnu-library/3.4/rJava/libs/rJava.so':
  libjvm.so: cannot open shared object file: No such file or directory

The suggested 'duplicate' is all about editing RStudio files etc. but I don't have any issues loading rJava within RStudio, the issue is I can't load rJava from the terminal using RScript or within an R session.

MidnightDataGeek
  • 938
  • 12
  • 21
  • @jay.sf I can run rJava fine from within rstudio, I have already followed those steps, I can't run the package in r-base or in a terminal window? – MidnightDataGeek Mar 06 '19 at 13:06
  • 1
    I found the answer here [rJava can load in RStudio but not in R](https://stackoverflow.com/questions/41494585/setting-ld-library-path-from-inside-r) – MidnightDataGeek Mar 07 '19 at 18:36

0 Answers0