Skip to content

Commit 1ee9f7b

Browse files
authoredJun 19, 2018
Merge pull request #167 from jruby/jruby-load-ext
loading JOpenSSL's native ext part the JRuby 9.2 (internal) way
2 parents 4b67129 + 4797873 commit 1ee9f7b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎lib/jopenssl/load.rb

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
warn 'Loading jruby-openssl gem in a non-JRuby interpreter' unless defined? JRUBY_VERSION
22

3-
require 'java'
43
require 'jopenssl/version'
54

65
warn "JRuby #{JRUBY_VERSION} is not supported by jruby-openssl #{JOpenSSL::VERSION}" if JRUBY_VERSION < '1.7.20'
@@ -26,9 +25,13 @@
2625
end
2726
end
2827

29-
require 'jruby'
3028
require 'jopenssl.jar'
31-
org.jruby.ext.openssl.OpenSSL.load(JRuby.runtime)
29+
30+
if JRuby::Util.respond_to?(:load_ext) # JRuby 9.2
31+
JRuby::Util.load_ext('org.jruby.ext.openssl.OpenSSL')
32+
else; require 'jruby'
33+
org.jruby.ext.openssl.OpenSSL.load(JRuby.runtime)
34+
end
3235

3336
if RUBY_VERSION > '2.3'
3437
load 'jopenssl23/openssl.rb'

0 commit comments

Comments
 (0)
Please sign in to comment.