RServe: serverSource failed, request status: control pipe to master process is closed/broken

Hello,

I have this R script

palindrome <- function(p) {
  for(i in 1:floor(nchar(p)/2) ) {
    r <- nchar(p) - i + 1
    if ( substr(p, i, i) != substr(p, r, r) ) return(FALSE) 
  }
  return(TRUE)
}

that I am calling from Java using the following code:

connection.serverSource("C:\\Users\\x\\Desktop\\R Script\\Palindrome.R");

the connection is of type RConnection is created as follows:

public void startConnection() {
        PATH_TO_R = SystemUtils.IS_OS_UNIX ? "R" : "C:\\Program Files\\R\\R-3.6.1\\bin\\x64\\R.exe";	
		try {
			String cmd = PATH_TO_R + " -e " + "\"library(Rserve);Rserve(port=" + 6311+ ")\"";
			Runtime.getRuntime().exec(cmd);
			RConnection connection = new RConnection("localhost", 6311);
		} catch (IOException | RserveException e) {
			e.printStackTrace();
		}
}

The problem is I am having this error thrown and have no idea how to fix it:

org.rosuda.REngine.Rserve.RserveException: serverSource failed, request status: control pipe to master process is closed/broken

any help will be much appreciated!

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