Setup Java with R

To prevent future problems when using Java, you need to install Java to your machine correctly.

  1. Download the correct version of Java from
  2. Right-click the Java setup app to “Run as Admin”
  3. After installing Java, go to R and let your machine know the right path to Java (Make sure you run R as Admin as well).
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_311') # for 64-bit version
Sys.setenv(JAVA_HOME="C:\\Program Files (x86)\\Java\\jre1.8.0_311") # for 32-bit version
Mike Nguyen, PhD
Mike Nguyen, PhD
Visitng Scholar

My research interests include marketing, and social science.