Debmalya Biswas Debmalya Biswas - 1 year ago 199
Groovy Question

Installing Groovy

Recently I downloaded Groovy-2.3.6 and try to install it on Linux system. I follow the instruction from I set my GROOVY_HOME variable.

export GROOVY_HOME=/home/work/Software/groovy-2.3.6

Then I set my environment path variable to the Groovy bin folder

export PATH=$PATH:/home/work/Software/groovy-2.3.6/bin

The JAVA_HOME variable is already created.

Now when I'm trying to run any command of Groovy, It generate following error

Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/groo/tool/GroovyStarter
Caused by: java.lang.ClassNotFoundException:
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
Could not find the main class: Program will exit.

I was going through some website to solve that problem. I find that if I set wrong path to GROOVY_HOME then it can happen. I can't figure out what should be the right path for that variable. Can anyone help me with this please.

Answer Source

The simplest way to install Groovy on Linux/Mac is with SDKMAN. Here's what I suggest:

  • undo everything you've already done
  • install SDKMAN by running curl -s "" | bash
  • open a new terminal and install groovy with the command sdk install groovy 2.3.6

Going forward you can use SDKMAN to switch between different versions of Groovy (and Gradle, Grails, Griffon, etc.), install new versions, remove old versions, and so on.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download