Reputation: 1425
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?
Upvotes: 0
Views: 109
Reputation: 7166
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
)
Upvotes: 1