Groovy Installation

I tried to install groovy on Windows 7. I downloaded the archive from the groovy site. Unzip it. Add the path GROOVY_HOME

to the environment. Add bin path to environment. After that, I reloaded windows. But when I try to run groovy from cmd I get the error:

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

+7


source to share


6 answers


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

for other Groovy distributions.

The file %GROOVY_HOME%/conf/groovy-starter.conf

gives some more clues about what actually happens when binaries are run. With this in mind, the wrong binaries may be causing your problem. This can lead to expecting different classes or class names than provided by the updated catalogs GROOVY_HOME

, which will eventually lead to your error.

To do this, double check all your paths.

UPDATE:



I ran into this problem by accident because I was messing around with Groovy versions (just like I told you not to;)). Here's a simple tip on how to find out if all paths are correct (for Windows).

  • Open a command shell with cmd

    .
  • Enter set DEBUG=true

    to activate debug messages.
  • Enter groovysh

    (prompt for interactive Groovy -shell).
  • Look at the last lines where "java.exe" is called. There is a long statement containing all the resolved path dependencies. Check if they all contain the correct distribution like "groovy -2.4.4.jar".

amuses

+4


source


  • You just need to set GROOVY_HOME to your Groovy directory e.g. GROOVY_HOME = C: \ groovy \ groovy-2.4.6

  • And JAVA_HOME to JRE

  • Make sure both GROOVY_HOME / bin and JAVA_HOME / bin are available in your PATH



+4


source


According to their website install on windows , you may not have a set of Java paths:

Set the JAVA_HOME environment variable to point to your JDK. On OS X this is / Library / Java / Home, on other unixes / usr / java, etc. If you've already installed tools like Ant or Maven, you've probably already taken this step.

Could you please provide your GROOVY_HOME path and system PATH as well - you may have made a typo.

+3


source


Open a command prompt and check your paths with echo.

echo %path%
echo %JAVA_HOME%
echo %GROOVY_HOME%

      

+2


source


Variable name: GROOVY_HOME


Variable value:C:\Program Files\apache-groovy-sdk-2.4.14\groovy-2.4.14

in PATH
%GROOVY_HOME%

This is what worked for me.

+1


source


In my case, I forgot to add the Java path to ./bash_profile

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
export GROOVY_HOME=/Users/magic/Library/Develop-Tools/groovy-2.5.8/

export PATH=${PATH}:$JAVA_HOME
export PATH=${PATH}:$GROOVY_HOME/bin

      

According to the official doc

enter image description here

0


source







All Articles