The error of sudo R CMD javareconf

sudo R CMD javareconf Java interpreter : /usr/lib/jvm/default-java/jre/bin/java Java version : 1.8.0_121 Java home path : /usr/lib/jvm/default-java Java compiler : not present Java headers gen.: Java archive tool: trying to compile and link a JNI program detected JNI cpp flags : detected JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 … Continue reading “The error of sudo R CMD javareconf”

stratified sampling R: java.lang.OutOfMemoryError: Java heap space

I want to use this function here is the code on github to sample my dataset in 2 parts 90% traning data set ( for example) and 10% (the rest) are the test ( for example tried this code : library(XLConnect) library(readxl) library(xlsx) library(readxl) ybi <- read_excel(“D:/ii.xls”) #View(ybi) test= stratified(ybi, 8, .1) no= (test$ID_unit) # … Continue reading “stratified sampling R: java.lang.OutOfMemoryError: Java heap space”

Return R output to Java when using RServe

I am using rServe to integrate R and Java. I’m able to call R function from Java and that function returns summary of variable. But the problem is I am unable to display that summary in Java. Below is the snippet of Java code I’m using. RConnection c = new RConnection(); c.eval(“library(ggplot)”); REXP desc = … Continue reading “Return R output to Java when using RServe”

Warning Messages in Renjin

I am using Renjin to use R code in Java. when I am running R code with syntax: “engine.eval(new java.io.FileReader(“Forecast_temp.R”));” where “Forecast_temp.R” is the R code file. Renjin is showing some messages as given below Loading required package: stats Loading required package: graphics Loading required package: zoo Loading required package: stats Loading required package: timeDate … Continue reading “Warning Messages in Renjin”

How to start rserve automatically from java in windows

I have created a java application in eclipse. The application used Rserve package to connect to R and run r scripts. Before running my application, i have to start rserve from within Rstudio like this: library(Rserve) Rserve() This Java code would be bundled as an executable file, so is there a way that Rserve() is … Continue reading “How to start rserve automatically from java in windows”

rJava – method with signature not found

My problem is similar to this one : Even with adding the semicolon didn’t work for me this is my method when i call .jmethod to display it for me : [10] “public java.util.Set utils.Rinterface.getPhones()” when I call the method, Like this rJava::.jcall(rinterface,”Ljava.util.Set;”,”getPhones”) I got this error : rJava::.jcall(rinterface, “Ljava.util.Set;”, “getPhones”) : method getPhones with … Continue reading “rJava – method with signature not found”

Recently updated R / RStudio, rJava could not be loaded.

I recently updated R to 3.4 and RStudio to its RStudio v1.0.143 Preview so that it’s compatible with the image updates & plots for R, but now I’m having an issue with rJava when trying to load it or packages that require it. It’s as follows: Loading required package: rJava Error: package or namespace load … Continue reading “Recently updated R / RStudio, rJava could not be loaded.”

Cran-R can't find jvm.dll when issuing command library(rJava)

My Cran-R x64 3.3.4 was working fine. However recently, I installed a the latest version of Java because another program required it (Interactive Brokers TWS). Now when I run R and want to load rJava or xlsx I get an error message that jvm.dll can’t be found. TWS runs fine, but apparently R is unhappy. … Continue reading “Cran-R can't find jvm.dll when issuing command library(rJava)”

rJava: Creating zero-length Java arrays from R

I am looking for the rJava equivalent of: String[] s; s= new String[0]; I tried: library(rJava) .jinit() s=.jarray(list(NULL), “[Ljava/lang/String;”) But when passing it to a method expecting a String[] with jcall(…, s), rJava raises an error. Update To make my question clearer. I could, of course, easily make a new jar (or modifying the existing … Continue reading “rJava: Creating zero-length Java arrays from R”

Execute R Script from Web Application with Java

I have created a Web Application with Struts, and I would like to execute and R script from a Java class. My script is in the directory: WebContent/script The name is: rScript.R I have checked that a way to execute is using this: Runtime.getRuntime().exec(“WebContent/script/rScript.R”) But this doesn’t work. Does someone know how I have to … Continue reading “Execute R Script from Web Application with Java”