问题
So I tried everything I found online but with no luck. I am trying to use qdab library that requires rJava.
So I install rJava, try to run library("rJava") and get
> library("rJava")
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
Error: package or namespace load failed for ‘rJava’
Then I tried to add path manually, by Sys.setenv and that's what's happening:
> Sys.setenv(JAVA_HOME="C:\\Program Files (x86)\\Java\\jre1.8.0_31")
> library("rJava")
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'D:/Moje Dokumenty/R/win-library/3.1/rJava/libs/x64/rJava.dll':
LoadLibrary failure: %1 nie jest prawidłową aplikacją systemu Win32.
Error: package or namespace load failed for ‘rJava’
I reinstalled java, tried few other solutions but that should do it and it didn't. What else can I do ?
回答1:
Ok I solved it by installing 64bit Java and clearing JAVA_HOME in R using:
if (Sys.getenv("JAVA_HOME")!="")
Sys.setenv(JAVA_HOME="")
library(rJava)
回答2:
I had the same problem until I installed the 64-bit version of Java. You have to manually download the 64-bit version. The default installer is the 32-bit version.
Follow this link to the manual download page:
http://www.java.com/en/download/manual.jsp
来源:https://stackoverflow.com/questions/28350723/rjava-not-loading-in-r