11

I am using a 64-bit machine, with the latest version of R (3.1.2), the latest RStudio version (0.98.1091) and the latest JAVA (Version 8 Update 31).

I tried to require rJava (rJava_0.9-6) and the result is the following error:

require(xlsx)
Carregando pacotes exigidos: rJava
Error : .onLoad falhou em loadNamespace() para 'rJava', detalhes: 
chamada: fun(libname, pkgname)
erro: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures.
Failed with error:  ‘package ‘rJava’ could not be loaded’

I already tried to re-install Java with no sucess.

Does anybody know how can I solve this problem?

Davi Moreira
  • 943
  • 3
  • 10
  • 23
  • Is your Java also 64-bit? I think you might have a 32-bit Java and that's what the 'R and Java have different architectures' error means. – LyzandeR Feb 06 '15 at 15:01
  • I have done the standard installation procedure in java.com. How can I verify if it installed the 32-bit instead of the 64-bit? – Davi Moreira Feb 06 '15 at 15:12
  • 1
    `java -d64 -version` on command line. Taken from [here](http://stackoverflow.com/questions/2062020/how-can-i-tell-if-im-running-in-64-bit-jvm-or-32-bit-jvm-from-within-a-program) – LyzandeR Feb 06 '15 at 15:15
  • 2
    @LyzandeR you were correct! I do not know why JAVA standart setup was installing 32bit configuration. I did it manually and everything is going well. Would you like to do an answer? I think the question will help other users. Or I will just delete the question. Thanks a lot. – Davi Moreira Feb 06 '15 at 19:07
  • I will provide an answer just in case it helps :). thanks ! – LyzandeR Feb 06 '15 at 19:10

2 Answers2

13

I think the problem on this occasion is that your Java is 32-bit, whereas your R is 64-bit. This is why you get a R and Java have different architectures error.

In order to check what your Java version is on Windows type:

java -d64 -version

on the command line as it is mentioned here.

I think that once you install the correct Java version i.e. the 64-bit on this occasion then loading your xlsx library will work!

Community
  • 1
  • 1
LyzandeR
  • 37,047
  • 12
  • 77
  • 87
4

The architecture of Java you get for install from the regular Java download web page depends on the architecture of browser you’re using (32-bit or 64-bit) when you download it. This happens without any fanfare. Try the Java manual download page, select the 64-bit version of Java for your OS, install it, and then (after restarting R) try your R packages again.