0

Can someone please help me get around the problem I am having with xlsx

I successfully installed the package xlsx in R. however when I load the xlsx library I keep getting the following error. I uninstalled Java, restarted PC and re-installed the latest Java version but that didnt fix the problem. Thanks in advance

I am running R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet" Operating system : Windows 7 professional, SP 1 Java version 1.8.0_25 (latest)

"package ‘xlsx’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in C:\Users\Mathan\AppData\Local\Temp\Rtmp6BDr2b\downloaded_packages

library("xlsx") Loading required package: rJava Error : .onLoad failed in loadNamespace() for 'rJava', details: call: fun(libname, pkgname) error: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures. Error: package ‘rJava’ could not be loaded"

Jude
  • 31
  • 1
  • 1
  • 3
  • 2
    Did you try googling this?? You need to have a version of Java (e.g. 32 or 64 bit) that is consistent with your R version. That is what "architecture" means in the error message. See: http://www.r-statistics.com/2012/08/how-to-load-the-rjava-package-after-the-error-java_home-cannot-be-determined-from-the-registry/ – jlhoward Dec 11 '14 at 22:51
  • Are you using 64-bit R and 32-bit Java? This could be the cause. – Steven Dec 11 '14 at 22:52
  • thanks Steven and jlhoward. I was in fact using 64 bit R and 32 bit java. However setting Java home in Sys.setenv didnt fix the problem. – Jude Dec 11 '14 at 23:04
  • options(java.home="C:\\Program Files\\Java\\jre1.8.0_25") library("rJava") worked. http://stackoverflow.com/questions/7019912/using-the-rjava-package-on-win7-64-bit-with-r – Jude Dec 11 '14 at 23:08

1 Answers1

2

Turns out I was using 64 bit R and 32 bit Windows and that was causing the problem.

I got it working by setting options(java.home="C:\Program Files\Java\jre1.8.0_25") library("xlsx")

The following links were helpful: http://www.r-statistics.com/2012/08/how-to-load-the-rjava-package-after-the-error-java_home-cannot-be-determined-from-the-registry/ Using the rJava package on Win7 64 bit with R

thanks to Steven and jlhoward for their help

Community
  • 1
  • 1
Jude
  • 31
  • 1
  • 1
  • 3