Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. Process process = Runtime.getRuntime().exec("/home/username/Desktop/mosesdecoder/bin/moses -f /home/username/Desktop/mosesdecoder/model/moses.ini");
  2.  
  3. while (true) {
  4. OutputStream stdin = null;
  5. InputStream stderr = null;
  6. InputStream stdout = null;
  7. stdin = process.getOutputStream();
  8. stderr = process.getErrorStream();
  9. stdout = process.getInputStream();
  10.  
  11. // "write" the parms into stdin
  12. line = "i love you" + "n";
  13. stdin.write(line.getBytes());
  14. stdin.flush();
  15. stdin.close();
  16. // Print out the output
  17. BufferedReader brCleanUp =
  18. new BufferedReader(new InputStreamReader(stdout));
  19. while ((line = brCleanUp.readLine()) != null) {
  20. System.out.println("[Stdout] " + line);
  21. }
  22. brCleanUp.close();
  23. }
  24.  
  25. Exception in thread "main" java.io.IOException: **Stream Closed**
  26. at java.io.FileOutputStream.writeBytes(Native Method)
  27. at java.io.FileOutputStream.write(FileOutputStream.java:297)
  28. at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
  29. at java.io.BufferedOutputStream.**flush(BufferedOutputStream.java**:140)
  30. at moses.MOSES.main(MOSES.java:60)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement