Note that there are some explanatory texts on larger screens.

plurals
  1. POJava and R integration
    text
    copied!<p>I am trying to build a java project which contains R codes. Main logic behind that is I want to automate the data structuring and data analysis with in a same project. Partially I am being able to do that. I connected R to Java and my R codes are running well. I did all my set up in the local machine and its giving me all output as I need. As data set is big I am trying to run this on amazon server. But when I am shifting it to server, my project is not working properly. Its not being able to execute <code>library(XLConnect), library(rJava)</code>. When ever I am calling this two libraries in my java project it's crashing. Independently in R codes are running and giving me output. What I can I for that, and how to fix thus error. Please help me out from this.</p> <hr> <p>My java codes is </p> <pre><code>import java.io.InputStreamReader; import java.io.Reader; public class TestRMain { public static void main(String[] arg)throws Exception{ ProcessBuilder broker = new ProcessBuilder("R.exe","--file=E:\\New\\Modified_Best_Config.R"); Process runBroker = broker.start(); Reader reader = new InputStreamReader(runBroker.getInputStream()); int ch; while((ch = reader.read())!= -1) System.out.print((char)ch); reader.close(); runBroker.waitFor(); System.out.println("Execution complete"); } } </code></pre> <p>And in the <code>Modified_Best_Config.R</code> I have written these codes </p> <pre><code>library('ClustOfVar'); library("doBy"); library(XLConnect) #library(rJava) #library(xlsx) path="E:/New/"; ############Importing and reading the excel files into R############## Automated_R &lt;- loadWorkbook("E:/New/Option_Mix_Calculation1.xlsx") sheet1 &lt;- readWorksheet(Automated_R, sheet = "Current Output") sheet2 &lt;- readWorksheet(Automated_R, sheet = "Actual Sales monthly") sheet3 &lt;- readWorksheet(Automated_R, sheet = "Differences") #####################Importing raw Data############################### optionData&lt;- read.csv(paste(path,"ModifiedStructureNewBestConfig1.csv",sep=""),head=TRUE,sep=","); nrow(optionData) optionDemand=sapply(split(optionData,optionData$Trim),trimSplit); optionDemand1=t(optionDemand[c(-1,-2),]); optionDemand1 ################Calculating the equipment Demand#################### optionDemand2&lt;-t(optionDemand2[c(-1,0)]); Rownames &lt;- as.data.frame(row.names(optionDemand2)) writeWorksheet(Automated_R,Rownames, sheet = "Current Output", startRow = 21, startCol = 1) writeWorksheet(Automated_R,optionDemand2, sheet = "Current Output", startRow = 21, startCol = 2) saveWorkbook(Automated_R) </code></pre> <p>But java is stopping its operation after these line. </p> <pre><code> library("doBy"); </code></pre> <p>Whole set of codes are running on nicely on my local machine. But whenever I am trying to run this on amazon server it's not running. Individually in R this code is running on server. I have couple of more R codes which are running with out any error. What can I do for that, please help me out. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload