Answered By: Kristin Yeager Last Updated: Aug 15, 2016 Views: 6528
Some R packages depend on Java (via the R package rJava) in order to function. This includes the packages xlsx and XLConnect, which are used to read from and write to Excel files in R. If you have installed either package and are getting an error message about JAVA_HOME when trying to load the package:
Windows users: You may need to update your version of Java, or you may need check that your version of Java has the same "bitness" (32-bit or 64-bit) as your version of R.
Mac users: Macs do not have Java installed by default, so you will need to download and install Java. (You do not have to have Excel installed in order to read and write to Excel files in R.) Your version of Java must match the "bitness" (32-bit or 64-bit) as your version of R.
- OS X 10.11 (El Capitan): You may need to install a legacy version of Java (Java SE 6) in order to use certain packages. You can download this legacy version from Apple's website directly.
All users who need to install Java can download it from java.com.
Users troubleshooting this issue in R can find helpful information at the following links:
Stack Overflow: How can I install rJava for use with 64-bit R on a 64-bit Windows computer?
Users who need to read Excel files into R (*.xls or *.xlsx) can also try the readxl package, which does not have any external dependencies; however, this package can not write data to Excel files as of this writing (August 2016).
Links & Files
- Download Java - Oracle Corporation Opens in new window
- Download Legacy Java SE 6 Runtime - Apple Opens in new window
- Verify Java Version - Oracle Corporation Opens in new window
- How do I install Java? - Oracle Corporation Opens in new window
- Stack Overflow: How can I install rJava for use with 64-bit R on a 64-bit Windows computer? Opens in new window
- R-statistics blog: How to load the rJava package after the error "JAVA_HOME cannot be determined from the Registry" Opens in new window
Was this helpful? 0 0