Options

Problem with the standard and the Execute Program Operator

AlpalentlessAlpalentless Member Posts: 1 Contributor I
edited November 2018 in Help
Hello people,

I'm currently working with RapidMiner 6 and at the end of a process I have to pipe out the Data Set to a Java Program.

In the documentation says that a process like : "Write CSV (fil) -> (in) Execute Program" will send the data set through the standard output to the program I'm executing, but the the process keeps failing and returning an error.

I'm using the following code in Java
public class WakaMain {

public static void main(String[] args) throws IOException {
ArrayList<String> input = new ArrayList<String>();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String inLine = br.readLine();
int i = 0;
while(i < 10){
input.add(inLine);
inLine = br.readLine();
i++;
}
br.close();
writeStream(input);
System.out.println("Done: "+input.size()+" Inputs");
}

public static void writeStream(ArrayList<String> in) throws IOException{
FileWriter fw = new FileWriter("StreamWriteOutput.csv");
PrintWriter pw = new PrintWriter(fw);
for(int i = 0; i<in.size();i++){
pw.println(in.get(i));
}
pw.close();
}

}
And every time I run the process I get the following error:

image

What am I doing wrong here? D=

Answers

  • Options
    Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    you can't pipe from Java via cmd to a new Java process it seems (I never tried that). Probably the easiest way is to actually write the .csv file and have your program read it again instead of relying on pipes. The tutorial process works because there the output is piped to a system tool (sort) directly.

    Regards,
    Marco
Sign In or Register to comment.