install Groovy in RedHat as4

官方网是这样写的:
1,first, Download a binary distribution of Groovy and unpack it into some file on your local file system
2,set your GROOVY_HOME environment variable to the directory you unpacked the distribution
3,add GROOVY_HOME/bin to your PATH environment variable
4,set your JAVA_HOME environment variable to point to your JDK. On OS X this is /Library/Java/Home, on other unixes its often /usr/java etc. If you’ve already installed tools like Ant or Maven you’ve probably already done this step.

但会出现错误:
# groovysh
java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
        at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:27)
        at org.codehaus.groovy.runtime.Invoker.<init>(Invoker.java:38)
        at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:44)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeNewN(ScriptBytecodeAdapter.java:225)
        at org.codehaus.groovy.tools.shell.Main.<clinit>(Main.groovy:34)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:101)
        at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130)


解决办法:
#vi /etc/profile

加入GROOVY_HOME
export GROOVY_HOME=”/home1/software/groovy-1.5.0/”

修改CLASSPATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:”/home1/lib/”:$GROOVY_HOME/lib/ant-1.7.0.jar:$GROOVY_HOME/lib/asm-2.2.jar:$GROOVY_HOME/lib/bsf-2.4.0.jar:$GROOVY_HOME/lib/jline-0.9.93.jar:$GROOVY_HOME/lib/mx4j-3.0.2.jar:$GROOVY_HOME/lib/ant-junit-1.7.0.jar:$GROOVY_HOME/lib/asm-analysis-2.2.jar:$GROOVY_HOME/lib/commons-cli-1.0.jar:$GROOVY_HOME/lib/jsp-api-2.0.jar:$GROOVY_HOME/lib/servlet-api-2.4.jar:$GROOVY_HOME/lib/ant-launcher-1.7.0.jar:$GROOVY_HOME/lib/asm-tree-2.2.jar:$GROOVY_HOME/lib/commons-logging-1.1.jar:$GROOVY_HOME/lib/junit-3.8.2.jar:$GROOVY_HOME/lib/xpp3_min-1.1.3.4.O.jar:$GROOVY_HOME/lib/antlr-2.7.6.jar:$GROOVY_HOME/lib/asm-util-2.2.jar:$GROOVY_HOME/lib/groovy-1.5.0.jar:$GROOVY_HOME/lib/mockobjects-core-0.09.jar:$GROOVY_HOME/lib/xstream-1.2.2.jar

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.