I want my Rails app to call a Java program to do some labor-intensive work. What's the best way to get the output from the Java program into Ruby? The output is text, about 60,000 chars per query.
Is there a better way than writing/reading from textfiles?
I don't want to use JRuby.
output = %x{java your_program.java}
Depends on scale. It could be worth actually setting up a messaging protocol such as RabbitMQ.
If you are just setting up a monitor or other script driven process, you could look at ruby's IO.popen, but that would still leave you parsing text streams.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With