问题
I am using XLConnect to read in xlsx files in R (version 3.4.4), but I get the warnings below. I think they might be related to Java, but I am not a Java user, and I do not know how to make them go away. Thanks!
MWE with any xlsx file:
library(XLConnect)
infile <- 'any.xlsx'
wb <- loadWorkbook(infile)
mydf <- readWorksheet(wb, sheet=1, region='A1:AS91', header=TRUE, check.names=FALSE, useCachedValues=TRUE)
WARNINGS:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.poi.openxml4j.util.ZipSecureFile$1 (file:/usr/local/lib/R/site-library/XLConnect/java/poi-ooxml-3.17.jar) to field java.io.FilterInputStream.in
WARNING: Please consider reporting this to the maintainers of org.apache.poi.openxml4j.util.ZipSecureFile$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
回答1:
From the error report, I would tell you are using Java 9 or more recent, isn't it?
This will be solved with the next release of Apache POI 4.0.0 where this warning originates from.
After Apache POI 4.0.0 has been released, maintainers of XLConnect will be able to upgrade their dependencies. At that time you will have to upgrade the version of XLConnect in your project and the warning will never appear again.
Alternatively, you could downgrade the installed Java runtime environment to JRE 1.8.161 if you are not depending on the most recent version for any other needs.
来源:https://stackoverflow.com/questions/51719176/r-xlconnect-loadworkbook-warnings-an-illegal-reflective-access-operation-has