ProcessBuilder, require, load path, and java.class.path

I am working with a library that uses ProcessBuilder to fork another JVM
process however the forked process is unable to find any of the jars I
required in my ruby program e.g. “Error: Could not find or load main
class
X”

After looking over
(ClasspathAndLoadPath · jruby/jruby Wiki · GitHub)
I am still unsure about what the best approach to adding jars & paths to
the java.class.path System property.

My workaround for this is to set the property manually, e.g.

full_classpath = [java.lang.System.properties[‘java.class.path’],
File.join(File.expand_path(‘…/…/vendor/jars-test’, FILE), ‘*’)]
java.lang.System.properties[‘java.class.path’] =
full_classpath.join(‘:’)

Is there a better way to do this?

Ariel V.
e-mail: [email protected]
website: http://blog.arielvalentin.com
skype: ariel.s.valentin
twitter: arielvalentin
linkedin: Sign Up | LinkedIn