-
-
Save calavera/819148 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
require 'hello_world.jar' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
$CLASSPATH << 'hello_world.jar' | |
$CLASSPATH << 'hello_world_directory' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ irb | |
jruby-1.6.0.RC2 :001 > require 'java' | |
=> true | |
jruby-1.6.0.RC2 :002 > require '/Users/david/dev/jruby/lib/jruby.jar' | |
=> true | |
jruby-1.6.0.RC2 :003 > $CLASSPATH | |
=> ["file:/Users/david/dev/jruby/lib/jruby.jar"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
F = java.io.File | |
class_loader = JRuby.runtime.jruby_class_loader | |
class_loader.add_url(F.new('hello_world_directory').to_url) | |
class_loader.add_url(F.new('hello_world.jar').to_url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@JRubyMethod(name = {"append", "<<"}, required = 1) | |
public IRubyObject append(IRubyObject obj) { | |
String ss = obj.convertToString().toString(); | |
try { | |
URL url = getURL(ss); | |
getRuntime().getJRubyClassLoader().addURL(url); | |
} catch (MalformedURLException mue) { | |
throw getRuntime().newArgumentError(mue.getLocalizedMessage()); | |
} | |
return this; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment