Mohamed Saleh
Mohamed Saleh

Reputation: 135

failing to load rjava in R script using rDotNet in C#

i'm using c# and R.NET.Community package to run R script from a c# application, i can run any script with no reference to rjava library with the code below but the code below crashed when the script contain the line Library(rJava) and gives me RDotNet.EvaluationException: 'Error: package or namespace load failed for 'rJava', error: unable to load shared object 'C:/Users/..../Documents/R/win-library/3.4/rJava/libs/i386/rJava.dll', i can run the script all right from Rstudio with no errors and correct output, but it gives this error when running it using RDotNet and C#

REngine engine = REngine.GetInstance();
rfile = rfile.Replace("\\", "/");
engine.Evaluate("source('" + rfile + "')");

Upvotes: 0

Views: 440

Answers (1)

Mohamed Saleh
Mohamed Saleh

Reputation: 135

The problem was that my script was allocating a lot of memory hence using java (x64) version while my application was running the 32 version of java hence not being able to allocate that memory, all i did was open project properties by right clicking the project then clicking properties and from under build set target to x64.

Upvotes: 1

Related Questions