To install Groovy, follow these steps:
1. Download the latest version of Groovy from the official website at https://groovy-lang.org/download.html.
2. Extract the downloaded archive to a directory of your choice.
3. Set the GROOVY_HOME environment variable to the directory where you extracted Groovy.
4. Add the $GROOVY_HOME/bin directory to your system’s PATH environment variable.
5. Verify that Groovy is working by opening a terminal or command prompt and typing “groovy -v”. This should display the version of Groovy that you installed.
Here are more detailed instructions for installing Groovy on different operating systems:
On Windows:
1. Download the latest version of Groovy for Windows from the official website.
2. Extract the downloaded archive to a directory of your choice, such as C:\groovy.
3. Open the System Properties dialog by right-clicking on My Computer and selecting Properties.
4. Click on the Advanced tab, then click on the Environment Variables button.
5. Under System Variables, click the New button.
6. In the Variable Name field, enter GROOVY_HOME.
7. In the Variable Value field, enter the path to the directory where you extracted Groovy, such as C:\groovy.
8. Click OK to close the Environment Variables dialog.
9. In the System Properties dialog, click OK to close the dialog.
10. Open a new command prompt window and type “groovy -v” to verify that Groovy is working.
On macOS:
1. Download the latest version of Groovy for macOS from the official website.
2. Open the downloaded DMG file and drag the Groovy icon to your Applications folder.
3. Open a terminal window and type “nano
/.bash_profile" to open your bash profile file. 4. Add the following lines to the file: export GROOVY_HOME=/Applications/Groovy.app/Contents/Resources/groovy export PATH=$PATH:$GROOVY_HOME/bin 5. Save the file by pressing Control + O, then exit nano by pressing Control + X. 6. Reload your bash profile by typing "source
/.bash_profile”.
7. Type “groovy -v” to verify that Groovy is working.
On Linux:
1. Download the latest version of Groovy for Linux from the official website.
2. Extract the downloaded archive to a directory of your choice, such as /opt/groovy.
3. Open a terminal window and type “sudo nano /etc/environment” to open the system environment file.
4. Add the following line to the file:
GROOVY_HOME=”/opt/groovy”
5. Save the file by pressing Control + O, then exit nano by pressing Control + X.
6. Reload the environment file by typing “source /etc/environment”.
7. Type “groovy -v” to verify that Groovy is working.