The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Problem with the standard and the Execute Program Operator
Alpalentless
Member Posts: 1 Learner III
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
What am I doing wrong here? D=
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 {And every time I run the process I get the following error:
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();
}
}
What am I doing wrong here? D=
0
Answers
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