刚开始学习groovy,在[url]http://dist.groovy.codehaus.org/distributions/groovy-binary-1.6.0.zip[/url]下载groovy的最新稳定版。解压到D:\Program Files 里面,然后设置环境变量(在这里假设JDK已安装好并设置好其环境变量):
写一个groovy文件:
然后运行:
google了数下,并没有找到答案,记得前两天在学习dlog4j的时候是因为tomcat的路径(D:\Program Files\apache-tomcat-6.0.16)里有空格而出现找不到"hibernate.cfg.xml"的问题,所以就想是不是空格再作怪,然后更改groovy的路径为:D:\groovy-1.6.0
环境变量设为:
再次运行:
非常好,一切正常了!
呵呵,事后在[url]http://www.chinagroovy.org/groovywiki/doku.php/wiki:getting_started_guide:tutorial_1[/url]发现了这样一段话:
[quote]
当前有一个问题是,如果在Windows中安装Groovy,则安装路径中不能包含空格。所以,不能使用默认的安装路径“c:\Program Files\Groovy”,而必须改为其他不含空格的路径,譬如“c:\Groovy”
[/quote]
GROOVY_HOME=D:\Program Files\groovy-1.6.0;
path=%GROOVY_HOME%\bin;%path%;
写一个groovy文件:
//hello.groovy
println "hello, world"
for (arg in this.args ) {
println "Argument:" + arg;
}
// this is a comment
/* a block comment, commenting out an alternative to above:
this.args.each{ arg -> println "hello, ${arg}"}
*/
然后运行:
E:\groovy> groovy hello.groovy aa bb cc
Caught: java.io.FileNotFoundException: E:\groovy\groovy.ui.GroovyMain
(E:\groovy\groovy.ui.GroovyMain)
google了数下,并没有找到答案,记得前两天在学习dlog4j的时候是因为tomcat的路径(D:\Program Files\apache-tomcat-6.0.16)里有空格而出现找不到"hibernate.cfg.xml"的问题,所以就想是不是空格再作怪,然后更改groovy的路径为:D:\groovy-1.6.0
环境变量设为:
GROOVY_HOME=D:\groovy-1.6.0;
再次运行:
E:\groovy>groovy hello.groovy aa bb cc
hello, world
Argument:aa
Argument:bb
Argument:cc
非常好,一切正常了!
呵呵,事后在[url]http://www.chinagroovy.org/groovywiki/doku.php/wiki:getting_started_guide:tutorial_1[/url]发现了这样一段话:
[quote]
当前有一个问题是,如果在Windows中安装Groovy,则安装路径中不能包含空格。所以,不能使用默认的安装路径“c:\Program Files\Groovy”,而必须改为其他不含空格的路径,譬如“c:\Groovy”
[/quote]
555

被折叠的 条评论
为什么被折叠?



