Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: JRuby 0.9.8
-
Component/s: None
-
Labels:None
Description
It should be possible to add jars / any urls to the search path (classpath) that JRuby uses when resolving include_class. This would make it possible to write scripts that configure their own search path, making calling them much easier as setting up the CLASSPATH is tedious when a lot of jars are involved. Setting up the search path for ruby code is already possible (the variable $
, so adding stuff to java classpath should be possible, too.
This should be pretty easy to implement using a subclass of java.net.URLClassLoader.
Something like this, maybe:
require 'java'
Java.classpath << URL.new('foo.jar') # at least a string, a java.net.URL, java.io.File and Ruby File should be acceptable params
Issue Links
- duplicates
-
JRUBY-618
We should have a $CLASSPATH variable
-
There is already a addToClasspath in org.jruby.javasupport.JavaSupport which serves this purpose. You would only have to put it into a Ruby package.