Besides installing Java, you have to set the path in the JAVA_HOME variable, you can do it by adding this command in your Rprofile.site file (obviously you have to modify the path accordingly to the Java version you have installed)
Sys.setenv('JAVA_HOME'="C:/Program Files/Java/jdk-11.0.1/")