When loading rJava I get the following error message:
Error in get(Info[i, 1], envir = env) : lazy-load database 'C:/Users/dell_x/Documents/R/win-library/3.3/rJava/R/rJava.rdb' is corrupt
I have tried setting JAVA_HOME to the jre directory by doing all of these:
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java')
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_121')
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_121\\bin')
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_121\\bin\\server')
However, none of them seem to work. Before this, I was using the 32 bit version of Java and tried setting it to the 32 bit version (Program Files (x86)). The 32 bit version does not work either.
This is what I get when I query the PATH:
> Sys.getenv("PATH")
[1] "C:\\Program Files\\R\\R-3.3.0\\bin\\x64;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\WIDCOMM\\Bluetooth Software\\;C:\\Program Files\\WIDCOMM\\Bluetooth Software\\syswow64;C:\\Program Files (x86)\\Common Files\\Roxio Shared\\DLLShared\\;C:\\Program Files (x86)\\Common Files\\Roxio Shared\\10.0\\DLLShared\\;C:\\Program Files (x86)\\Skype\\Phone\\;C:\\Program Files (x86)\\Calibre2\\;C:\\Program Files\\Git\\cmd;C:\\Users\\dell_x\\AppData\\Local\\Microsoft\\WindowsApps;"
I have the latest version of Java installed both in 32 and 64 bit. All I want is to be able to use open rJava in R. None of the paths I've mentioned earlier have worked (I still get an error when loading the Java library into R) and I can't find a specific jre folder or file to set the path to.
This is a duplicate of both: Unable to load rJava on R and Problems loading rJava Package on Win7.
I needed to install the Java SE Development Kit for rJava to work (should have read the package's documents) and then set the JAVA_HOME path to the jre folder inside "jdk1.8.0_121". Finally restart RStudio and everything works fine (I can load the rJava package).
Sorry for the duplicate.