To solve the problem of loading rjava in installation of xlsx

[run target]
import XLSX file,
install. Packages (” rJava “)
install. Packages (” xlsxjars “)
install. Packages (” XLSXX “)
install

[error prompt]

library (XLSX) Error: package or namespace load failed for ‘XLSX:
loadNamespace counting’ rJava ‘in his (). When the onLoad fails, the detailed content:
call: inDL (x, as the logical (local), as the logical (now),…).
error: unable to load Shared object “d:/Program Files/R/R – 3.5.0/library/rJava/libs/x64/rJava DLL: ‘
LoadLibrary failure: % 1 is not a valid Win32 application.

solution 】 【 1, Java on the website to download the Windows version of the Java software

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

download download time attention to agree with statement after good Java installation
note:
if R is 64-bit, the installed Java must also be 64-bit and placed in C:\Program Files…
if you install C:\Program Files (x86), the system will continue to report the following error

2, download the Java, and install it, Under CMD, type
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_171
Path=C:\Program Files\Java\jdk1.8.0_171\bin
you can also manually set


3, finally re-run
library(rJava)
library(xlsxjars)
library(XLSX)
XLSX package imported successfully

Read More: