2

I would like to run a java program from within a ruby script, using rjb. All in all, I would like to write a String to the Stdin as input for the program and read its output from stdout.

I have tried something like that, but the script just hangs:

Open3.popen3(Java.com.package.name.anothername.Classname.main([--arg1, …])) do |i, o, e, t|
    i.write "Hello World!"
    i.close
    puts o.read
end

What could I do to fix that?

philipp
  • 15,947
  • 15
  • 61
  • 106

0 Answers0