Groovy development requires Groovy Compiler which requires JVM to be installed already because the Groovy code is running in top of JVM. In other words
JRE to be installed first and then Kolin Compiler to be installed.
JDK contains the Java Runtime Environment (JRE)
and JRE contains the Java Virtual Machine (JVM).
Groovy Compiler is the only tool which will be responsible for compiling the Groovy source code and it will generate a self executable JAR file
with the same name with .jar extension (for example HelloWorld.jar) and rest of the executions
will be handled by JRE with the help of Java Virtual Machine (JVM).
Java Development Kit (JDK) configuration for Windows machine
Ensure your system was already loaded with the
JDK. To check that open the command prompt
and execute the command java -version,
it will show the installed JDK's version in the
command prompt only if exist otherwise download it from the official site and install it manually.
Install the JDK in the following default directory C:\Program Files\Java\jdk1.8.0_221 and you can move the JDK software to another location as per your wish.
Check the JDK is updated the Environment Variable or not, by opening the command prompt and execute the command java -version. It will show the installed JDK's version otherwise follow the below steps to setup the environment variable path.
Set Path of JDK in Windows system environment variables
1. Copy the path of the JDK's bin folder
2. Open the Environment variable dialog using the Windows Run. Press Win + R and run the command rundll32.exe sysdm.cpl,EditEnvironmentVariables
or open the Environment variable by windows search using the search text environment variable
3. Select the Path variable and click the Edit which is under User Variable
4. Click the New button and add the path C:\Program Files\Java\jdk1.8.0_221\bin and finally click the Ok button.
5. Open the new command prompt and execute the command java -version, it will show the installed JDK's version.
6. JDK configuration succussfully completed, let try our first java program in the next chapter.
Groovy Standalone Command Line Compiler configuration for Windows machine
Ensure your system was already loaded with the Groovy Compiler. To check that open the command prompt and execute the command groovy --version, it will show the installed Groovy Compiler's version in the command prompt only if exist otherwise download it from the official site and install it manually.
Unzip the downloaded version of Groovy Compiler package in the following directory default directory C:\groovy-2.5.8 and you can move the Groovy Compiler to another location as per your wish.
Check the JDK is updated the Environment Variable or not, by opening the command prompt and execute the command groovy --version. It will show the installed Groovy's version.
Set Path of Groovy Compiler in Windows
1. Copy the path of the Groovy Compiler's bin folder
2. Open the environment variables dialog as mentioned above
3. Click the New button and add the path C:\groovy-2.5.8\bin and finally click the Ok button.
4. Open the new command prompt and execute the command groovy --version, it will show the installed Groovy Compiler's version.
5. Groovy Compiler configuration succussfully completed, let try our first groovy program in the next chapter.