Here is some info:
Operation system: Windows 10 Pro
R version: R x64 4.1.2
Java version: Java 8 Update 281 (64-bit)
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
The package you want to install needs an installation of java. So you need to be sure you have Java installed and it is able to find/is pointed towards that installation.