Problem with launching JAGUAR in R - r

Windows XP, R 2.11.1, Java JRE6
I just installed the Jaguar package.
From an R console, I can do this:
> library(JGR)
Loading required package: rJava
Loading required package: JavaGD
Loading required package: iplots
Please use the corresponding JGR launcher to start JGR.
Run JGR() for details. You can also use JGR(update=TRUE) to update JGR.
and so JGR appears to be correctly installed.
JGR() yields
On Windows JGR must be started using the JGR.exe launcher.
Please visit http://www.rosuda.org/JGR/ to download it.
>
I'm not sure how to run Jaguar - I know I have to run jgr.exe - but should R be already open? If so, should the JGR library be already loaded? I've tried all of these, and what seems to happen regardless is a console window opens briefly, then disappears. I've run jrg --debug, with no apparent error message: (same file regardless of choice made above).
What should I be doing?
Thanks!
System: Version 5.1 (build 2600), platform 2 [Service Pack 3]
JGR loader version 1.61 (build Jul 23 2008)
parseParams> 1 parameters parsed.
parseParams par 10> "--debug"
> rhome="C:\Program Files\R\R-2.11.1"
> srhome="C:\PROGRA~1\R\R-211~1.1"
getPkgVersion(JGR): 010702
getPkgVersion(rJava): 000805
getPkgVersion(JavaGD): 000503
getPkgVersion(iplots): 010103
Loading preferences from "C:\Documents and Settings\gblais\.JGRprefsrc"
> javakey="Software\JavaSoft\Java Runtime Environment\1.6"
> javah="C:\Program Files\Java\jre6"
> tp="C:\Perl\site\bin;C:\Perl\bin;C:\PHP\;C:\Program Files\MiKTeX 2.8\miktex\bin;C:\Python26\Lib\site-packages\PyQt4;C:\Program Files\Tcl\bin;C:\oracle\product\10.2.0\client_2\BIN;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Support Tools\;c:\belfry;c:\belfry\usr\local\wbin;C:\WINDOWS;C:\WINDOWS\System32;C:\WINDOWS\System32\WBEM;c:\Program Files\QuickTime\QTSystem\;C:\Program Files\SlikSvn\bin\;c:\progra~1\Microsoft Visual Studio 9.0\VC\bin\"
Got RuntimeLib from registry, using "C:\Program Files\Java\jre6\bin\client;" PATH prefix.
Java home: "C:\Program Files\Java\jre6"
R home: "C:\Program Files\R\R-2.11.1"
JAR files: "-Drjava.class.path=C:\PROGRA~1\R\R-211~1.1\library\rJava\jri\JRI.jar;C:\PROGRA~1\R\R-211~1.1\library\iplots\java\iplots.jar;C:\PROGRA~1\R\R-211~1.1\library\JGR\java\JGR.jar;C:\PROGRA~1\R\R-211~1.1\etc\classes;C:\PROGRA~1\R\R-211~1.1\etc\classes.jar"
desired PATH: "C:\Program Files\Java\jre6\bin\client;C:\Program Files\Java\jre6\bin\client;C:\Program Files\Java\jre6\bin;C:\Program Files\R\R-2.11.1\bin;C:\PROGRA~1\R\R-211~1.1\library\rJava\jri;C:\Perl\site\bin;C:\Perl\bin;C:\PHP\;C:\Program Files\MiKTeX 2.8\miktex\bin;C:\Python26\Lib\site-packages\PyQt4;C:\Program Files\Tcl\bin;C:\oracle\product\10.2.0\client_2\BIN;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Support Tools\;c:\belfry;c:\belfry\usr\local\wbin;C:\WINDOWS;C:\WINDOWS\System32;C:\WINDOWS\System32\WBEM;c:\Program Files\QuickTime\QTSystem\;C:\Program Files\SlikSvn\bin\;c:\progra~1\Microsoft Visual Studio 9.0\VC\bin\"
actual PATH: "C:\Program Files\Java\jre6\bin\client;C:\Program Files\Java\jre6\bin\client;C:\Program Files\Java\jre6\bin;C:\Program Files\R\R-2.11.1\bin;C:\PROGRA~1\R\R-211~1.1\library\rJava\jri;C:\Perl\site\bin;C:\Perl\bin;C:\PHP\;C:\Program Files\MiKTeX 2.8\miktex\bin;C:\Python26\Lib\site-packages\PyQt4;C:\Program Files\Tcl\bin;C:\oracle\product\10.2.0\client_2\BIN;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Support Tools\;c:\belfry;c:\belfry\usr\local\wbin;C:\WINDOWS;C:\WINDOWS\System32;C:\WINDOWS\System32\WBEM;c:\Program Files\QuickTime\QTSystem\;C:\Program Files\SlikSvn\bin\;c:\progra~1\Microsoft Visual Studio 9.0\VC\bin\"
getenv PATH: "C:\Perl\site\bin;C:\Perl\bin;C:\PHP\;C:\Program Files\MiKTeX 2.8\miktex\bin;C:\Python26\Lib\site-packages\PyQt4;C:\Program Files\Tcl\bin;C:\oracle\product\10.2.0\client_2\BIN;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Support Tools\;c:\belfry;c:\belfry\usr\local\wbin;C:\WINDOWS;C:\WINDOWS\System32;C:\WINDOWS\System32\WBEM;c:\Program Files\QuickTime\QTSystem\;C:\Program Files\SlikSvn\bin\;c:\progra~1\Microsoft Visual Studio 9.0\VC\bin\"
argv[0]:C:\PROGRA~1\Java\jre6\bin\java.exe
argv[1]:-Drjava.class.path=C:\PROGRA~1\R\R-211~1.1\library\rJava\jri\JRI.jar;C:\PROGRA~1\R\R-211~1.1\library\iplots\java\iplots.jar;C:\PROGRA~1\R\R-211~1.1\library\JGR\java\JGR.jar;C:\PROGRA~1\R\R-211~1.1\etc\classes;C:\PROGRA~1\R\R-211~1.1\etc\classes.jar
argv[2]:-Xmx512m
argv[3]:-cp
argv[4]:C:\PROGRA~1\R\R-211~1.1\library\rJava\java\boot
argv[5]:-Drjava.path=C:\PROGRA~1\R\R-211~1.1\library\rJava
argv[6]:-Dmain.class=org.rosuda.JGR.JGR
argv[7]:-Djgr.load.pkgs=yes
argv[8]:-Djgr.loader.ver=1.61
argv[9]:RJavaClassLoader
argv[10]:--debug

Have you tried the instructions from the JGR website?
 
Installation instructions:
Download and install R 2.5.0 or higher (Linux/Solaris: make
sure --enable-R-shlib was used when
compiling R)
Download the appropriate JGR application for your OS from above
(Windows/Mac OS X) or install JGR
package from CRAN.
Start the JGR application! JGR will install all necessary packages
directly from CRAN (or the RoSuDa
server). (You should have
administrator rights to get the
packages installed)
After step 3 completed successfully, JGR is fully installed
and can be used.
Windows users: if you have more than one JDK version installed, you
can use this tiny tool to select the
default version that will be used with
JGR: jselect.exe.
The Windows launcher accepts the
following optional command line
parameters:
--debug - show debugging info and create c:/jgrdebug.txt (must be the
first parameter if used)
--rforge - use www.rforge.net for package installation instead of CRAN
(useful to install latest development
packages)
--cran=xxx - use xxx as CRAN mirror for package installation
--libs=xxx - use xxx as package location (use only if you don't have
write permission in the default R
package location)

Related

Although the xlsx package is installed in R, it does not work

Although the xlsx package is installed, it does not work.
I get the following error. What should I do? I use the latest version of R
install.packages("xlsx")
Installing package into ‘C:/Users/Cgdm/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/xlsx_0.6.5.zip'
Content type 'application/zip' length 374910 bytes (366 KB)
downloaded 366 KB
package ‘xlsx’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Cgdm\AppData\Local\Temp\RtmpCy2Eng\downloaded_packages
library(xlsx)
Error: package or namespace load failed for ‘xlsx’:
onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
Common Problems -- Java and xlsx package
R users who have not previously used packages that rely on Java often have problems when attempting to use the xlsx package that is used to read Excel spreadsheets.
Java runtime not installed
First, many new R users have not previously needed to install a Java runtime on their computers. The xlsx package depends on the rJava and xlsxjars packages. rJava requires the Java Runtime Environment 1.2 or above to also be present on one's computer.
Solution 1: Use an excel reader package that doesn't require Java
PRO TIP: The easiest way to work around this problem is to use an R package that does not depend on Java, such as openxlsx or readxl.
For openxlsx, it's very easy.
install.packages("openxlsx")
library(openxlsx)
# read the help file to identify the arguments needed to
# correctly read the file
?openxlsx
theData <- read.xlsx(...)
The same process can be used for readxl.
install.packages("readxl")
library(readxl)
# read the help file to identify the arguments needed to
# correctly read the file
?readxl
theData <- read_excel(...)
Solution 2: Install Java and required R packages
That said, for people who still want to use the xlsx package, there are workable solutions for Windows, Mac OSX, and Ubuntu Linux.
SOLUTION (Windows): Download and install the latest version of the Java Runtime Environment from Oracle. Note that if you are running the 64-bit version of R, you need to install the 64-bit version of the Java Runtime.
SOLUTION (Mac OSX): As of newer releases of Mac OSX, this has become more complicated. A specific set of commands needs to be followed after installing the Java Development Kit on the computer. These are documented on the rJava Issue 86 github page.
SOLUTION (Ubuntu): Use the Ubuntu Advanced Packaging Tool to install Java, then reconfigure Java in R.
sudo apt-get install openjdk-8-jdk # openjdk-9-jdk has some installation issues
sudo R CMD javareconf
Then in R / RStudio install the xlsx package.
install.packages("xlsx")
32-bit vs. 64-bit Java in Windows
Another common problem people may encounter is an incompatibility between the version of the Java Runtime Environment that is installed on their computer and the version of R, either 32-bit or 64-bit.
For example, if one has installed the 64-bit version of R but has the 32-bit version of Java Runtime Environment installed, R will not have visibility to the Java Runtime Environment, generating the same "Java not installed error" as noted above.
SOLUTION: This problem can be resolved by either installing the 64-bit version of Java Runtime for Windows, or by changing the RStudio configuration to use the 32-bit version of R.
One can identify the version of Java that is installed, and whether it is 32 or 64-bit, by executing the following function within R / RStudio.
system("java -version")
...which on a Windows-based PC will return something like this.
Extracting Java settings from Windows registry
Another approach to validating the version of Java that is installed on a Windows-based machine is to use utils::readRegistry() (h/t Access Windows Registry inside R).
readRegistry("SOFTWARE\\JavaSoft\\Java Runtime Environment","HLM",maxdepth=3)
returns the following:
> readRegistry("SOFTWARE\\JavaSoft\\Java Runtime Environment","HLM",maxdepth=3)
$BrowserJavaVersion
[1] "11.261.2"
$CurrentVersion
[1] "1.8"
$`1.8`
$`1.8`$JavaHome
[1] "C:\\Program Files\\Java\\jre1.8.0_261"
$`1.8`$MicroVersion
[1] "0"
$`1.8`$RuntimeLib
[1] "C:\\Program Files\\Java\\jre1.8.0_261\\bin\\server\\jvm.dll"
$`1.8.0_261`
$`1.8.0_261`$JavaHome
[1] "C:\\Program Files\\Java\\jre1.8.0_261"
$`1.8.0_261`$MicroVersion
[1] "0"
$`1.8.0_261`$RuntimeLib
[1] "C:\\Program Files\\Java\\jre1.8.0_261\\bin\\server\\jvm.dll"
$`1.8.0_261`$MSI
$`1.8.0_261`$MSI$AUTOUPDATECHECK
[1] "1"
$`1.8.0_261`$MSI$AUTOUPDATEDELAY
[1] ""
$`1.8.0_261`$MSI$EULA
[1] ""
$`1.8.0_261`$MSI$FROMVERSION
[1] "NA"
$`1.8.0_261`$MSI$FROMVERSIONFULL
[1] ""
$`1.8.0_261`$MSI$FullVersion
[1] "1.8.0_261-b12"
$`1.8.0_261`$MSI$INSTALLDIR
[1] "C:\\Program Files\\Java\\jre1.8.0_261\\"
$`1.8.0_261`$MSI$JAVAUPDATE
[1] "1"
$`1.8.0_261`$MSI$JU
[1] ""
$`1.8.0_261`$MSI$OEMUPDATE
[1] ""
$`1.8.0_261`$MSI$PRODUCTVERSION
[1] "8.0.2610.12"
This is a lot of output, but we can still see that the current version of Java is 1.8, and the JavaHome setting is C:\\Program Files\\Java\\jre1.8.0_261. Since the registry tree is relatively complicated, it takes a fair amount of knowledge to write the correct key to reduce the amount of output returned.
# more specific extract, given that $CurrentVersion is 1.8
readRegistry("SOFTWARE\\JavaSoft\\Java Runtime Environment\\1.8","HLM",maxdepth=3)
...returns a more targeted set of registry settings.
> readRegistry("SOFTWARE\\JavaSoft\\Java Runtime Environment\\1.8","HLM",maxdepth=3)
$JavaHome
[1] "C:\\Program Files\\Java\\jre1.8.0_261"
$MicroVersion
[1] "0"
$RuntimeLib
[1] "C:\\Program Files\\Java\\jre1.8.0_261\\bin\\server\\jvm.dll"
Java / R compatibility with non-English versions of Windows 10
Note that as of July 2020, users on Stackoverflow.com have reported problems installing Java and rJava in the scenario where the version of Windows is a non-English language version (e.g. Chinese, Polish, etc.). It appears that the way the Java installer works with these versions of Windows, R and the rJava package are not able to access the JAVA_HOME directory correctly.
To correct the problem, reinstall R with the same language used by Windows. That is, on the Chinese version of Windows, install R with Chinese langauge support. Once installed, you can change the language to English by setting language = "en" in the .Rconsole file.
Reference: Common Problems: Java and xlsx package, originally posted by me on my Johns Hopkins Data Science Specialization Community Mentor Repository, January 2017.
It seems that your JAVA_HOME is not configured correctly, hence
from https://www.rdocumentation.org/packages/xlsx:
"Ensure that the system environment variable JAVA_HOME is configured appropriately and points to your jdk of choice. Typically, this will be included in your PATH environment variable as well. Options and system environmental variables that are available from R can be seen with Sys.getenv()."
Check your config by doing
d <- Sys.getenv()
d[names(d) == "JAVA_HOME"]
It should point to your Java installation, e.g. "C:\Program Files\Java\jdk1.8.0_104"
On Windows 10, this can be set in "Advanced System Settings, System Properties, Environment Variables"

write.xlsx function not working

I am trying to use .xlsx library but function write.xlsx is returning error that such can not be found.
When I am installing library(xlsx) in log I can read:
Error : .onLoad nie powiodło się w funkcji 'loadNamespace()' dla pakietu 'rJava', szczegóły:
wywołanie: fun(libname, pkgname)
błąd: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures.
In addition: Warning messages:
1: pakiet ‘xlsx’ został zbudowany w wersji R 3.3.2
2: pakiet ‘rJava’ został zbudowany w wersji R 3.3.3
Error: pakiet ‘rJava’ nie mógł zostać załadowany
Java is up to date.
The code in the original post fails because the xlsx package uses the Apache POI Java API to Excel, and therefore requires the rJava package. In turn, the rJava package requires a working, compatible version the Java Runtime Environment to be installed on the machine and accessible from R.
One can tell whether Java is accessible from R / RStudio via the system() function.
> system("java -version")
java version "13.0.2" 2020-01-14
Java(TM) SE Runtime Environment (build 13.0.2+8)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
>
There are at least four sets of R packages used for working with Excel files, including:
xlsx -- requires rJava package
XLConnect -- requires rJava package
openxlsx -- does not require rJava package
readxl / writexl -- does not require rJava package
For options 3 and 4, the solution is simply to use install.packages() to install the desired package (as noted in another answer by #Linus), once you've updated R to the latest version.
install.packages("openxlsx")
library(openxlsx)
or
install.packages(c("readxl","writexl"))
library(readxl)
library(writexl)
A Working Example: Write to Excel File
library(writexl)
data <- data.frame(matrix(runif(100),nrow=10,ncol=10))
write_xlsx(data,"./data/simpleExcel.xlsx")
...and the output:
If You Must Use rJava...
Unfortunately, options 1 and 2 are considerably more complicated than "install Java." If one must use xlsx or needs the rJava package to support other R packages, installation of Java varies significantly by operating system.
Windows: one must install a version of Java whose architecture is compatible with R (i.e. 32-bit vs. 64-bit). One may consider installing both 32-bit and 64-bit versions because some Windows programs installed on the computer may require 32-bit Java vs. 64-bit. With RStudio, one can configure R to use the 32-bit version of R if only 32-bit Java is installed on the machine.
Mac OS X: one must install Java and run a series of commands that are documented on the rJava Issues GitHub page, including executing an R script to reconfigure Java for R.
Linux: one needs to install Java using the package installer tool appropriate for the version of Linux, and then configure R to use it. For example, in Ubuntu one would install with the advanced packaging tool.
sudo apt-get install openjdk-8-jdk # openjdk-9-jdk has some installation issues
sudo R CMD javareconf
xlsx needs Java. Please install the current Java version from https://www.java.com/de/
and watch out, that both R and java are either 32bit or 64bit as it is stated in the error message
... and make sure R and Java have matching architectures.
Or use writexls or openxlsx. They are not depending on Java (Thanks #Len)

rattle installation error: Invalid root element:

I am new to data mining and R. Please provide how to proceed with following query.
I want to use the R-package Rattle for my data analysis on my MS Win 10- X64 system. I am following these instructions. I install the package using
install.packages("rattle")
After selecting a CRAN mirror, it RGUI installs the package and gives following message:
package ‘rattle’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\XXX\AppData\Local\Temp\RtmpYnMZM1\downloaded_packages
after that I run the code,
library(rattle)
and RGui gives following response;
Rattle: A free graphical interface for data mining with R.
Version 4.1.0 Copyright (c) 2006-2015 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
After this, I call the function 'rattle'.
rattle()
and I get the following error:
Error in method(obj, ...) : Invalid root element: 'requires'
I tried the same in the RStudio console as well. Also, I uninstalled RStudio and R X64, X386 and re-installed the same and tried again, but I fail to browse the reason for this error.
It seems RGtk2 related. grep in installed rattle directory shows this
$ grep 'requires' -r .
./etc/rattle.glade: <!-- interface-requires gtk+ 2.16 -->
./etc/rattle.ui: <!-- interface-requires gtk+ 3.0 -->
./etc/rattle.ui.160313: <!-- interface-requires gtk+ 3.0 -->
./etc/rattle.ui.with_export_filechooser: <!-- interface-requires gtk+ 3.0 -->
./etc/rattle_macosx.ui: <requires lib="gtk+" version="2.16"/>
./NEWS: * Note rattle.ui requires gtk > 2.16, not > 2.20. Otherwise fails to
./NEWS: * Check for GtkBuilder handling of the 'requires' tag, and if not
./NEWS: Gtk library installed does not recognise 'requires' and suggest a
Seems RGtk2 is causing the problem, emitting complains about the presence of the element named requires.
Solution I:
Downgrade RGtk2 from 2.20.33 to 2.20.31 worked for me.
Solution II:
Later I upgrade everything to the latest, including Windows GTK+2. Rattle stopped working. But rattle works again when invoked as below:
rattle( useGtkBuilder = TRUE)
Now I stick with the latter way.
On RGtk/GTK+ version:
I can't drag Rattle gui window around or resize it freely on Windows 7. This has been a constant pain. Higher version of RGtk2 or GTK2 doesn't seem to fix it (demo apps in GTK2 folder doesn't have this problem. But RGtk2 demo scripts do). So RGtk/Gtk+ version didn't make any difference for me.
PS:
If you are running R-3.4.0 and trying to install the dev version from togaware.com, download http://rattle.togaware.com/bin/windows/contrib/3.3/rattle_5.0.10.zip ( which is actually built with R-3.4.0 thus doesn't work on 3.3.3 ) install it locally.
Use the script below for the install the dev version 5.0.18 as of 7/10. It'll save you from all the hassle
install.packages("rattle", repos="http://rattle.togaware.com")

Unable to install DeployR Open 8.0.0 on Windows 10

I am trying to install DeployR Open 8.0.0 on Windows 10 (64 bits). I have installed the following dependencies:
JRE 8
Revolution R Open 3.2.2 and MKL (RevoMath 3.2.2)
DeployR Rserve 7.4.2
I followed the install instructions for RRO & MKL and DeployR. I have also done a clean install, that is prior to installing all these stuff, I uninstalled R, and RStudio.
However, when start installing DeployR Open 8.0.0 (even as Administrator), it is unable to find the dependencies/prerequisites, and on clicking next it opens this page, which more or less talks about the same set of dependencies.
Here are the screenshots:
I am not sure what I am missing here. Please suggest.

R studio failing to use rJava lib and failing javareconf

I'm running Rstudio on its own server.
Java is installed with good java_home and bin.
R is installed. rJava is installed.
Tried to do command: library("rJava") but had issues with libjvm.so, do following Rstudio recommandation I did sudo R CMD javareconf with root.
Here is the output of my javareconf:
Java interpreter : /home/scoremd/jdk1.7.0_03/jre/bin/java
Java version : 1.7.0_03
Java home path : /home/scoremd/jdk1.7.0_03
Java compiler : /home/scoremd/jdk1.7.0_03/bin/javac
Java headers gen.: /home/scoremd/jdk1.7.0_03/bin/javah
Java archive tool: /home/scoremd/jdk1.7.0_03/bin/jar
NOTE: Your JVM has a bogus java.library.path system property!
Trying a heuristic via sun.boot.library.path to find jvm library...
Java library path: $(JAVA_HOME)/jre/lib/amd64:$(JAVA_HOME)/jre/lib/amd64/server
JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64 -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
Seems there is issue with finding the java library path... but my java is working fine and R also.
I didn't receive any solution from RStudio support and community (told me to ask in SO ....).
I have rstudio-server installed on my Centos server. There are a couple of users using rstudio and we decided to upgrade R from 3.6 to 4.0.
After the upgrade :
all users were running R 4.0.
No user could install rJava using install.package('rJava'). This error always popped up
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’
Running SUDO R CMD javareconf went smoothly, and also when I opened R as root and went along and tried install.packages('rJava') it installed the package just fine. (unbeknownst to me, root ran R 3.6 and users 4.0, see solution below)
However it did not work installing the package for users in R studio server. Always stating the same "try running sudo R CMD javareconf" as if the Java path for the users was wrong.
so we tried setting the "JAVA_HOME" variable to the same path that java jdk was installed in (found by searching installed packages in yum). That did not solve it.
my solution
I saw that root was running version 3.6 of R while all users ran 4.0. This was because I had installed 4.0 in another directory.. The directory of R 4.0 happens to be found first by the users. However for the root user... it finds the path of R 3.6 first.
So I set the path to the 4.0 folder in the $PATH variable of the root user, so that would find version 4.0 before finding R 3.6
echo $PATH
export PATH="/usr/local/bin:$PATH"
echo $PATH
Then I ran R as that user and ran "R CMD javareconf", installed the packages and all users are happy and working again.
(disclaimer, I'm not a experienced linux admin, there may be a better solution for running different R versions)
It's been some time since I used rJava, and it was on Windows, but I have some notes which may help you:
Make sure that the JRI native library is in a directory listed in java.library.path
(also confirmed using Process Explorer that jri.dll is being loaded)
The R process loads up jvm.dll when you do library(rJava)
Replace jvm.dll iny my notes above with libjvm.so in your case, and jri.dll with whatever .so file is relevant to you.

Resources