0

I want to start irb (Interactive Ruby Shell) in terminal using java and then execute different commands on that already opened irb shell when particular event occurs. I have tried Runtime.exec() method but it executes commands on terminal or command prompt only and is unable to execute commands in irb shell. Also every time it executes commands on new instance of terminal instead of same instance. I want to execute multiple commands on same terminal instance instead of newly created instance of terminal.

Please suggest. Thanks in advance.

  • What code have you written? We need to see how you're doing it. – the Tin Man Sep 24 '13 at 18:32
  • you should be able to open irb then write via outputstream to it...how are you getting multiple console windows are you executing irb several times? I suppose another way would be to embed jruby and execute that... – rogerdpack Sep 24 '13 at 18:54
  • Thanks rogerdpack. I have used outputstream given by process to write and execute commands. I used solution provided at following link. http://stackoverflow.com/a/5437863/2141218 – user2141218 Sep 25 '13 at 09:10
  • I am stuck in mac for doing the same thing. I have tried following code : {String[] cmd = {"/bin/bash", "-k", "cd", "/Users/userName/Documents"}; Runtime.exec(cmd); } and {String[] cmd = {"open", "-a", "terminal.app"}; Runtime.exec(cmd); } but no luck.Please help... – user2141218 Oct 24 '13 at 05:41

0 Answers0