more robust check for JRuby