groovy配置

刚开始学习groovy,在 http://dist.groovy.codehaus.org/distributions/groovy-binary-1.6.0.zip下载groovy的最新稳定版。解压到D:\Program Files 里面,然后设置环境变量(在这里假设JDK已安装好并设置好其环境变量):


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


非常好,一切正常了!

呵呵,事后在 http://www.chinagroovy.org/groovywiki/doku.php/wiki:getting_started_guide:tutorial_1发现了这样一段话:

引用

当前有一个问题是,如果在Windows中安装Groovy,则安装路径中不能包含空格。所以,不能使用默认的安装路径“c:\Program Files\Groovy”,而必须改为其他不含空格的路径,譬如“c:\Groovy”

你可能感兴趣的:(tomcat,Hibernate,UI,PHP,groovy)