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.