0
votes

my computer is windows system, 64 bit. I am trying to install rJava_0.9-8,RWeka_0.4-29 and RWekajars_3.9.0-1 from local to R, R version is R3.4.1 and R3.0.8. Here is my steps and errors:

I tried install zip files as follows: package ‘rJava’ successfully unpacked and MD5 sums checked

utils:::menuInstallLocal() package ‘RWeka’ successfully unpacked and MD5 sums checked utils:::menuInstallLocal() package ‘RWekajars’ successfully unpacked and MD5 sums checked

then I checked it as follows:

library(rJava) Error: package or namespace load failed for ‘rJava’: .onLoad failed in loadNamespace() for 'rJava', details: call: fun(libname, pkgname) error: JAVA_HOME cannot be determined from the Registry library(RWeka) Error: package or namespace load failed for ‘RWeka’: .onLoad failed in loadNamespace() for 'rJava', details: call: fun(libname, pkgname) error: JAVA_HOME cannot be determined from the Registry

I even tried another way as follows: install.packages("G:/Data mining/rJava_0.9-8", type="win.binary", repos=NULL) Installing package into ‘C:/Users/Ellen/Documents/R/win-library/3.4’ (as ‘lib’ is unspecified) Error in .zip.unpack(pkg, tmpDir) : zip file ‘G:/Data mining/rJava_0.9-8’ not found

Can anybody help me install these zip files? Thanks

2

2 Answers

0
votes

Encountered this issue before.. Try installing 64-bit or 32-bit Java, depending on what r version you have...

error in installing RWeka package in R

I also had to mess around with some code to set the java_home environment variable.

Try messing around with this script, which is not in any order... either set the env variable to where Java is installed, or leave it blank, which seemed to work for me.

library(rJava)

Sys.setenv(JAVA_HOME='C:\\Program Files (x86)\\Java\\jre1.8.0_131')

install.packages('rJava')

Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_131\\bin') # for 64-bit version

# Need to set rJava to blank for it to load
Sys.setenv(JAVA_HOME='')

library(rJava)
Sys.getenv("JAVA_HOME") # Use this to see where the env var is pointing to

library(RWeka)
0
votes

I fixed the problem now, it was caused by my student account, not R. The solution is:

library(rJava,lib.loc ="H:/R")
install.packages("H:/2-COMP723_Data Mining/rJava_0.9-8.zip", repos = NULL, type = "win.binary",lib = "H:/R")
library(rJava)

Thanks guys.