This error is likely resolved by installing a Java version (e.g. 64-bit Java or 32-bit Java) that corresponds to the type of R version that you are using (e.g. 64-bit R or 32-bit R).
# check which version of R you are running
Sys.getenv("R_ARCH")
# check which version of Java is being utilized by R
system("java -version")
If you need a different version of Java then you'll need to manually download and install the right version from here. Don't forget to restart R and your browser after you install Java.