Prevent JRuby rubygems warnings from breaking the build

/cc @myronmarston 
This can be simplified to `RUBY_PLATFORM == 'java'`.