Corporate Training
Request Demo
Click me
Menu
Let's Talk
Request Demo

Tutorials

 Installation and Environment Setup

2. Installation and Environment Setup

Step 1: Install Java

Before you can use Groovy, you need to have Java installed on your system. Groovy runs on the Java Virtual Machine (JVM). You can download Java from the official Oracle website or use OpenJDK, which is a free and open-source alternative.

Step 2: Verify Java Installation

To ensure Java is installed correctly, open your command prompt (or terminal on macOS/Linux) and run the following command:

java -version
 

You should see the installed Java version information.

Step 3: Download Groovy

Visit the official Groovy website (https://groovy.apache.org/download.html) to download the Groovy binary distribution. Choose the latest version, download the ZIP or TAR file, and save it to a directory on your computer.

Step 4: Extract Groovy

Unzip or extract the downloaded Groovy archive to your preferred installation directory. For example, on Windows, you can use a tool like 7-Zip, and on macOS/Linux, you can use the 'tar' command.

Step 5: Set Environment Variables (Optional)

To use Groovy from any directory in your command prompt or terminal, you can add Groovy's 'bin' directory to your system's 'PATH' environment variable. This step is optional but recommended for convenience.

1. On Windows:

  • Open the "System Properties" > "Advanced" tab > "Environment Variables."
  • Under "System variables," find "Path" and click "Edit."
  • Add a new entry with the path to Groovy's 'bin' directory (e.g., 'C:\path\to\groovy-3.0.8\bin').
  • Click "OK" to save the changes.

2. On macOS/Linux:

  • Edit your shell configuration file (e.g., '~/.bashrc', '~/.zshrc', or '~/.profile') using a text editor.
  • Add the following line at the end:
export PATH=/path/to/groovy-3.0.8/bin:$PATH 

  • Save the file, and then run 'source ~/.bashrc' (or the respective file for your shell) to apply the changes.

Step 6: Verify Groovy Installation

Open a new command prompt or terminal window and run the following command:

groovy -version
 

You should see the installed Groovy version information.

Congratulations, you've successfully installed Groovy and set up your development environment. You're now ready to start writing and running Groovy code!