Skip to content

Instantly share code, notes, and snippets.

@nahi
Created June 13, 2012 06:54
Show Gist options
  • Select an option

  • Save nahi/2922421 to your computer and use it in GitHub Desktop.

Select an option

Save nahi/2922421 to your computer and use it in GitHub Desktop.
% mkdir foo
% echo 'p [__FILE__, __LINE__, File.read(File.expand_path("./baz.txt", File.dirname(__FILE__)))]' > foo/bar.rb
% echo hello,world > foo/baz.txt
% jar -cf foo.jar foo
% rm -rf foo
% jruby -e '$LOAD_PATH << "foo.jar"; require "foo/bar"'
["jar:file:foo.jar!/foo/bar.rb", 1, "hello,world\n"]
% mkdir foo
% echo 'p [__FILE__, __LINE__, File.read(File.expand_path("./baz.txt", File.dirname(__FILE__)))]' > foo/bar.rb
% echo hello,world > foo/baz.txt
% jar -cf foo.jar foo
% mkdir a b
% cp -p foo.jar a
% cp -p foo.jar b
% rm -rf foo foo.jar
% jruby -e '$:.concat(["a/foo.jar", "b/foo.jar"]); require "foo/bar"'
["jar:file:a/foo.jar!/foo/bar.rb", 1, "hello,world\n"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment