R 64 bit not working on some computers

I need to know if any of you have encountered the following. 32 bit R scripts that use Java run fine on our 2 laptops and our remote desktop computer. The 64 bit R scripts that use Java we have run into an issue on 1 of the laptops and our remote desktop computer. Currently I am having to have those 64 bit R scripts run on my laptop which is not good. We have reinstalled R studio and Java on the one laptop and some system options, but the laptop cannot still run the 64 bit R scripts. Does anyone know what could be causing this?

Do you get any error message? Also, can you show the R code you are executing? It is not clear what you mean by "64-bit R script".

# Pittsburg, PA library download mirror
# options(repos = c(CRAN = "http://lib.stat.cmu.edu/R/CRAN/")) 

#0-Cloud (secure)
options(repos = c(CRAN="https://cloud.r-project.org/")) 

library("RODBC")
library("RODBCext")
library("RDCOMClient")
# library("xlsx")
library("lubridate")
library("xtable")
library("rpivotTable")
library("htmlwidgets")
library("stringr")
library("readxl")
library("zoo")

Sys.setenv(JAVA_HOME="C:\\Program Files\\Java\\jdk1.8.0_321")
library(rJava)
library(xlsx)

I get the following error during the library(rJava) and library(xlsx):

> Sys.setenv(JAVA_HOME="C:\\Program Files\\Java\\jdk1.8.0_321")
> library(rJava)
Error: package or namespace load failed for ‘rJava’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Users/n291001/Documents/R/win-library/3.4/rJava/libs/x64/rJava.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.
> library(xlsx)
Error: package or namespace load failed for ‘xlsx’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Users/n291001/Documents/R/win-library/3.4/rJava/libs/x64/rJava.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

If I do not run the Sys.setenv before the rJava I get the following error:

Error: package or namespace load failed for ‘rJava’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Users/n291001/Documents/R/win-library/3.4/rJava/libs/x64/rJava.dll':
  LoadLibrary failure:  The specified module could not be found.

The above is run in R version [Default] [64-bit] C:\Program Files\R\R-3.4.4

It seems you don't have a working x64 JDK installation in the specified JAVA_HOME path.

I would try reinstalling/updating the JDK x64 installation and making sure I'm using the right path.

Our IT person tried that on one of our laptops and we are still getting the same error.

Sadly, the only clue we have is pointing in that direction, the JDK is simply not running correctly in your system and this doesn't seem to be R-related. I would insist with your IT person because very likely this is a problem with the specific configuration of your system.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.