Struggled for about two hours to install rJava
on my Windows 10 machine. Post here the steps that made it work in case anyone is interested (that is, future me).
Check whether R is 32/64 bit with sessionInfo()
. Check Platform.
Download the specific 32/64 bit of Java. This is really important. R and Java must have the same memory signature, either 32 or 64 bit. I had 64 bit so I downloaded the Offline 64-bit version from here.
Download Java JDK for 32/64 bit. For 64-bit I had to download the Windows version from here.
If you installed 32-bit Java then everything should be saved in C:/Program Files (x86)/Java/
. Conversely, if you installed 64-bit then everything should be installed in C:/Program Files/Java/
.
Install rJava
with install.packages("rJava")
.
Set your JAVA_HOME
environment with Sys.setenv(JAVA_HOME="C:/Program Files/Java/jdk-10.0.1/")
so that it points to your specific (64-bit in my case) folder that contains the jdk
. Don’t worry about jdk-10.0.1
as this might change for future releases.
library(rJava)
throws no errors to me!
Good luck!