JRuby: changed CLASSPATH but no effect

135 Views Asked by At
include Java

cp = ENV["CLASSPATH"]
cp.split(/[;]/).each{|el| puts "#{el}"}

I changed a path in my CLASSPATH environment variable via regedit in Windows 7 but when I run the script above it prints me the old paths. Why doesn't it recognize that CLASSPATH has changed?

edit: It works after a computer reboot, but can't it work without having to do that?

1

There are 1 best solutions below

0
On

just set CLASSPATH= before running the script (will be kept until you close that particular command line) http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html

alternatively explicitly specify -cp on the command line with jruby :

jruby -J-classpath C:\java\MyClasses;C:\java\foo.jar ... (overrides CLASSPATH)