简体   繁体   English

JRuby:更改了CLASSPATH,但没有任何效果

[英]JRuby: changed CLASSPATH but no effect

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. 我在Windows 7中通过regedit更改了CLASSPATH环境变量中的路径,但是当我在上方运行脚本时,它会显示旧路径。 Why doesn't it recognize that CLASSPATH has changed? 为什么无法识别CLASSPATH已更改?

edit: It works after a computer reboot, but can't it work without having to do that? 编辑:重新启动计算机后它可以工作,但是不必这样做就不能工作吗?

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 只需在运行脚本之前set CLASSPATH= (将一直保留到关闭特定命令行为止) http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html

alternatively explicitly specify -cp on the command line with jruby : 或者,在命令行上使用jruby显式指定-cp

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM