0

I plan to write a website frontend for a free computer algebra system (Reduce, http://reduce-algebra.com/). On the webserver I have a Java virtual machine running, and Reduce is also installed.

I can start the application via exec() in the Java file. But my question is the following: how can I emulate user inputs and how can I retrieve the outputs of the program? The main issue is that I want to log the whole session, not just call the program once, get the output, close it, and restart it again.

I need a way that allows for interactive communication, i.e. a way to "paste" a command in the command line, and a way to "copy" the response back to the Java program.

  • How are you going to secure this session? Please be aware that loads of hackers will gladly try to penetrate your server. – Deer Hunter Jul 11 '14 at 10:51
  • Where to start? – Deer Hunter Jul 11 '14 at 10:51
  • I edited my original post to make it less general. Thanks for the heads up. – Jens Jul 11 '14 at 16:12
1

System.exec() returns a Process object, and that object allows you to get access to STDIN and STDOUT of the forked process. The names MAY seem backwards, though -- the child's STDIN is acquired via getOutputStream() -- but the names are from the point of view of your process, not the child.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.