I apologize in advance for my bad english, i hope that someone can help me. I have to load an Excel file .xlsx on R, but:
library(xlsx)
This was happening to me as well (also Windows 10), and the problem with mine was that the environment variable was not set properly. In my case, I had to do
Sys.setenv('JAVA_HOME' = 'C:/Program Files (x86)/Java/jre1.8.0_161/')
Just change the folder name to where Java lives in your computer, and let me know if this doesn't work out.
In Ubuntu 16.04 I did the following trick in RStudio:
Sys.setenv('JAVA_HOME' = '/usr/lib/jvm/java-8-oracle/jre')
Surprisingly, but
Sys.setenv('JAVA_HOME' = '/usr/lib/jvm/java-8-oracle/')
didn't work for me.