Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Groovy Installation

Tags:

groovy

I tried to install groovy in windows 7. I Downloaded archive from groovy site. Unzip it. Add GROOVY_HOME path to environment. Add bin path to environment. After that I rebooted windows. But when I try to run groovy from cmd I get error:

Error: Could not find or load main class org.codehaus.groovy.tools.GroovyStarter

like image 884
Pein Avatar asked Jul 20 '15 20:07

Pein


2 Answers

  1. You just need to set GROOVY_HOME to your Groovy directory, for example:

    GROOVY_HOME=C:\groovy\groovy-2.4.6
    
  2. And JAVA_HOME to JRE

  3. Make sure that both GROOVY_HOME/bin and JAVA_HOME/bin are available in your PATH

like image 168
kalyani chaudhari Avatar answered Sep 20 '22 15:09

kalyani chaudhari


You may have directories of other Groovy versions in your path. If you have installed Groovy before (may be years ago - doesn't matter), check your environment variables, especially PATH, for other Groovy distributions.

The file %GROOVY_HOME%/conf/groovy-starter.conf gives some more hints of what actually happens while starting the binaries. Having this in mind, the cause of your problem may be the usage of the wrong binaries. That may result in the expectation of other classes or class names than provided by the up to date GROOVY_HOME directories - eventually yielding your error.

Check all your paths twice for this.

UPDATE:

I accidentally just ran into that problem because I was messing around with Groovy-versions (just as I told you not to ;)). Here is an easy hint how to find out if all paths are correct (for Windows).

  1. Open your Command-Shell with cmd.
  2. Type in set DEBUG=true to activate the Debug-Statements.
  3. Type in groovysh (requesting the interactive Groovy-shell).
  4. Have a look at the last lines where "java.exe" is called. There is a long statement containing all resolved path dependencies. Check if these all contain your correct distribution, for instance, "groovy-2.4.4.jar".

cheers

like image 41
Kekzpanda Avatar answered Sep 18 '22 15:09

Kekzpanda