Add jruby support

The open4 gem isn't compatible with jruby. We can use IO.popen4, which provides the same functionality.