To excecute SENNA in the terminal I use the command:
senna.exe < input.txt > result.txt
Now I want to realize this in a java program. This is my code so far
ProcessBuilder builder = new ProcessBuilder("senna.exe");
builder.redirectErrorStream(true);
Process process = builder.start();
OutputStream stdin = process.getOutputStream();
InputStream stdout = process.getInputStream();
BufferedReader reader = new BufferedReader (new InputStreamReader(stdout));
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stdin));
writer.write("This is a test sentence");;
writer.flush();
String line;
while ((line = reader.readLine ()) != null) {
System.out.println ("Stdout: " + line);
}
To redirect the input, output and error stream I used the code from this thread. The problem is that I get the following error message:
FATAL ERROR: unable to open file hash/words.lst
Am I doing something wrong?