Add jruby support

The open4 gem isn't compatible with jruby. Open3.popen3 is supported by both platforms, but has some annoying bugs like not yielding anything until after the conversion is finished which is crucial.

We can use IO.popen4 for jruby, which provides the same functionality.