0

When trying to install package xlxs in R I get the following error.

error: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures.

Not sure what to do. I have tried reinstalling Java and still get the same error.

I have R 3.12 on a windows 10 computer.

Any advice is welcome,

Thanks

lebelinoz
  • 4,890
  • 10
  • 33
  • 56
  • Unrelated, but your R version is almost 3 years old. The latest is 3.4.2. The issue here is that the Java version needs to match your system architecture (32 or 64-bit). Google the error and you'll find several StackOverflow posts on this topic. Another option is to use `readxl` instead and avoid Java hell altogether. – neilfws Oct 04 '17 at 00:31
  • 1
    Also , this might be in play : https://stackoverflow.com/questions/28367964/problems-requiring-rjava-in-windows – R.S. Oct 04 '17 at 00:33
  • 2
    Also, you need to configure R for java, at the command prompt `R CMD javareconf` – Kevin Arseneau Oct 04 '17 at 00:35
  • I can use readxl to read excel file. How do I write in to excel file? – John 987 Samsung Oct 04 '17 at 00:59
  • 1
    `readxl` doesn't write to Excel. There's a `writexl` package: https://github.com/ropensci/writexl. Or the `openxlsx` package: https://github.com/awalker89/openxlsx. Or you could write to CSV and import. – neilfws Oct 04 '17 at 01:15
  • neilfws and R.S, Installing Java 64 seems to solve this issue. Thanks – John 987 Samsung Oct 04 '17 at 02:54

1 Answers1

0
Error: package or namespace load failed for ‘xlsx’:
.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.

The error normally occurs when the architectures(32/64 bit) of java and r does not match.

In order to check the version of java, type java -version in cmd.

You can follow below given steps:

Rstudio > tools > global options > general settings > R-version > change (to the architecture same as that of java) > apply

Screenshot of how it may look And you're good to go.

Roberto Caboni
  • 7,252
  • 10
  • 25
  • 39