Let's use some undocumented Java APIs to make the code work as it should...

... on JRuby/Windows.