Problem loading rJava

Yesterday I removed R2.11 from my system (Win7, 64 bit) since I am working on R2.13.

Since then I get the error message:

> require(rJava) Lade nΓΆtiges Paket: rJava Error : .onLoad in loadNamespace() fehlgechlagen, Details: Aufruf: rJava Fehler: inDL(x, as.logical(local), as.logical(now), ...) 

I tried to specify PATH, as I found on the Internet that it might have something to do with jvm.dll:

 c:\Rtools\bin; c:\Rtools\perl\bin; c:\Rtools\MinGW\bin; c:\Rtools\MinGW64\bin; C:\Windows\system32; %R_HOME%\bin; C:\Program Files\R\R-2.13.0\bin; C:\Program Files\Java\jre6\bin\server 

However, I could not solve the problem ... I also can not start R from the win command prompt (just enter "R"?)

Any suggestions?

+6
source share
6 answers

I finally solved the problem:

It seems that rJava is looking for jvm.dll in ~ \ Java \ jre6 \ bin \ client. However, this folder did not exist on my system (jvm.dll was in ~ \ bin \ server).

So, I just made a copy of jvm.dll in the ~ \ bin \ client \ folder and added this to the path.

Now everything works fine!

+3
source

Here are some tips on getting up and running R + rJava on Windows 7 64bit. There are several possibilities, but most of them have fatal flaws. Here is what worked for me:

Add jvm.dll to your PATH

rJava, the R ↔ Java bridge, will need jvm.dll, but R will have a problem finding this DLL. It is located in the type folder

 C:\Program Files\Java\jdk1.6.0_25\jre\bin\server 

or

 C:\Program Files\Java\jre6\jre\bin\client 

Wherever you are, add this directory to your Windows PATH variable. (Windows β†’ "Path" β†’ "Edit environment variables for your account" β†’ PATH β†’ change the value.)

You may have Java on your PATH. If so, you should find the client / server directory in the same Java home directory as the one already on your PATH.

To be safe, make sure your architectures match. If you have Java in Program Files , it is 64-bit, so you should run R64. If you have Java in Program Files (x86) , then it is 32-bit, so you are using regular 32-bit R.

Restart R from the Windows menu

If R is running, close.

In the menu "Start", "Start R / RGUI", "RStudio". It is very important that R picks up your PATH changes.

Install rJava 0.9.2.

Earlier versions do not work! Mirrors are not updated, so go to the source at www.rforge.net: http://www.rforge.net/rJava/files/ . Pay attention to advice

 "Please use `install.packages('rJava',,'http://www.rforge.net/')` to install." 

This is almost correct. This really works:

install.packages('rJava', .libPaths()[1], 'http://www.rforge.net/')

Watch for punctuation! The mysterious ".libPaths () [1]" simply tells R to install the package in the main library directory. For some reason, leaving a value blank does not work, although it should be the default.

+20
source

My problem was resolved with

 install.packages("SqlRender",INSTALL_opts="--no-multiarch") 

It was a package that depends on rJava, and all the tips told me to fix the Java installation. But the solution was to use an installation option that just forgets about the i386 architecture. (also works with drat library and non-CRAN packages)

+1
source

In my case, installing the correct version of Java solved my problem. I set the 64x java bit because I am using the 64 bit version of R.

0
source

I solved this by following these steps

  • setting up my Sys.setenv(JAVA_HOME='C:\\Program Files (x86)\\Java\\jre6') environment Sys.setenv(JAVA_HOME='C:\\Program Files (x86)\\Java\\jre6')
  • Manual installation of the rJava package from the installation package (even this should work: install.packages('rJava', .libPaths()[1], 'http://www.rforge.net/') )
  • library (rJava)
0
source
  • In the style of RStudio.LibPaths ()
  • This will give you the path on your Windows system where your libraries are located.
  • Go there and uninstall rJava. If it is used by Java applications, kill all Java programs in the task manager.

  • Go to computer and properties, click change environment variables

  • Edit JAVA_HOME and all Java-related paths to the path where the latest Java installation is located and saved.
-1
source

Source: https://habr.com/ru/post/891444/


All Articles