3

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.

3
  • Does "labor-intensive" mean you want it to happen asynchronously? Commented Apr 19, 2012 at 17:39
  • I think he means the java program does a lot of repetitive work. Commented Apr 19, 2012 at 17:44
  • No need for asynchronous execution Commented Apr 19, 2012 at 21:47

2 Answers 2

2
output = %x{java your_program.java}
Sign up to request clarification or add additional context in comments.

1 Comment

Nice. Thanks @texasbruce, just what I was looking for.
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.