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
source to share
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
source to share
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.
source to share
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
source to share