-2

I am running Win 10 64-bi with Java version 1.8.0.221. when loading xlsx package I am getting an error in R Studio with version 3.5.2 - also 64-bit. The error is in loading rJava. any thoughts on how can I fix this? I am stuck and can't move forward. Thanks.

trying URL 'https://mran.microsoft.com/snapshot/2019-02-01/bin/windows/contrib/3.5/xlsx_0.6.1.zip'
Content type 'application/zip' length 458979 bytes (448 KB)
downloaded 448 KB

package ‘xlsxjars’ successfully unpacked and MD5 sums checked
package ‘xlsx’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\<user>\AppData\Local\Temp\RtmpIZaYPe\downloaded_packages
> library(xlsx)
Error: package or namespace load failed for ‘xlsx’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Users/<user>/Documents/R/win-library/3.5/rJava/libs/x64/rJava.dll':
  LoadLibrary failure:  The specified module could not be found.
1
  • Most questions are older and hence may not be relevant Commented Oct 11, 2019 at 19:56

1 Answer 1

1

I added the following and then rJava loaded without error.

Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_221')
Sign up to request clarification or add additional context in comments.

3 Comments

Perhaps you should revise or delete your comment where you said "Most questions are older and hence may not be relevant", since your answer here is exactly (version/release number notwithstanding) what is in the other question.
This will only work for the current session. Maybe edit Rprofile?!
Yes, I added this to .RProfile. As for older versions, I was not sure if there was a change due to package and R version changes and wanted to make sure to find the latest info.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.