2

I am trying to make a con using rjdbc and rJava packages and i am getting this error:

C:\Users\user\dir>Rscript rjdbc.r
Loading required package: methods
Error : .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Users/user/Documents/R/win-library/3.0/rJava/libs/i386/rJava.dll':
  LoadLibrary failure:  The specified module could not be found.

Error: package or namespace load failed for 'rJava'

Additionally i get this pop-up error window

This program can't start because jvm.dll is missing from your computer

I am using java

java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) Client VM (build 25.5-b02, mixed mode)

R version is

R version 3.0.3 (2014-03-06) -- "Warm Puppy"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

and my env variables on Windows 8.1 Pro - 64-bit OS are currently

JAVA_HOME = C:\Program Files (x86)\Java\jre8
path = C:\Program Files (x86)\Java\jre8\bin;C:\Program Files (x86)\Java\jdk1.8.0_05\jre\bin\server

I have read tons of similar questions but still no success. Thanks for any suggestions

  • I had issues with `rJava` whilst trying to configure it for `Rbbg` and the following worked for me `if(Sys.getenv("JAVA_HOME")!="") Sys.setenv(JAVA_HOME="")`, check if it does for you – Silence Dogood May 02 '14 at 11:45
  • @Vivek I somehow solved the issue. I will delete this questions in a while if you dont mind. thanks –  May 02 '14 at 12:03
  • @Nick,if you could spare few minutes, could you post your own answer so that it helps others in the future, cheers – Silence Dogood May 02 '14 at 13:02

2 Answers2

2

So inside the R script i set a

Sys.setenv(JAVA_HOME='C:\\Program Files (x86)\\Java\\jre8')

as shown above, pointing to my JAVA_HOME environment variable.

Everything else is set as the Question shows.

That's pretty much it.

  • One note, this seems to only work with the JRE (Java Runtime Environment), you cannot use a JDK (Java Development Kit) install. – Timothy055 Oct 12 '14 at 02:07
1

Highlighting the comment on the original post, as the following specifically worked for me too:

"I had issues with rJava whilst trying to configure it for Rbbg and the following worked for me... check if it does for you – Osssan May 2 '14 at 11:45"

if(Sys.getenv("JAVA_HOME")!="") Sys.setenv(JAVA_HOME="");
Emissary
  • 9,954
  • 8
  • 54
  • 65
JohnC
  • 11
  • 1