2

I am using 64 bit windows 7 & 64 bit R 3.2.0. I have downloaded rJava package, but it is giving an error as follows.

Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dirname(this$RuntimeLib) error: a character vector argument expected In addition: Warning message: package ‘rJava’ was built under R version 3.2.2 Error: package or namespace load failed for ‘rJava’

I searched stackoverflow for answers, and did the following:

1) Added the jvm.dll file to my PATH variable, i.e. in the following directory:

C:\Program Files\Java\jdk1.8.0_25\jre\bin\

2) I am using 64 bit R 3.2.0 & checked if the JVM version was 64 bit or not, typing the following on the command line:

java -d64 -version

It gave the following output:

C:\Users\xyz> java -d64 -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

So at least the JVM matches with R.

So what more needs to be done to make rJava work? I also checked my PATH variable and it seems okay.

6
  • Take a look here and here perhaps Commented Oct 19, 2015 at 10:14
  • Thank you. This thread had the answer. stackoverflow.com/questions/7019912/… I tried this thing therein: But what's probably the best solution (since rJava 0.9-4) is overriding within R the Windows JAVA_HOME setting altogether: {options(java.home="C:\\Program Files\\Java\\jre7\\") library(rJava)} Commented Oct 19, 2015 at 10:25
  • I followed instructions as given in one of your links but it is still giving the error "jvm.dll" is not present in the machine even when I have it in my Java path. Commented Oct 19, 2015 at 10:43
  • Oh, I thought your problem was solved, reopening... Did you try both links btw? Commented Oct 19, 2015 at 10:44
  • I thought the same when I did not get any error for some time, but then my PC hanged and after closing and restarting R, it is giving this error "jvm.dll not found in your machine". As to the both links- I tried only one since the second one is about doing things in linux and I am using windows. I also created a JAVA_HOME environment variable and added the Java path therein. Commented Oct 19, 2015 at 10:50

2 Answers 2

6

I know this is way too late, but did you try switching R versions as a diagnostic step?

For RStudio 1.0.136: Tools -> Global Options... -> General: R version: Change - Choose 32 bit.

Changing versions worked for me and prompted me to revisit my java installation. (Ended up just using R32)

Got the same error with R64:

Loading required package: XLConnectJars
Error : .onLoad failed in loadNamespace() for 'rJava', details:
  call: dirname(this$RuntimeLib)
  error: a character vector argument expected
Error: package ‘XLConnectJars’ could not be loaded

Was running RStudio on Windows 10 using machine's default R64.

Sign up to request clarification or add additional context in comments.

Comments

5

Ya must specify where the jdk is. For example:
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jdk1.8.0_161')

then it should work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.