How Do You Run a Groovy Program on a Red Hat Derivative Linux Server?

Problem scenario
You want to use a Java Virtual Machine language on a CentOS/RHEL/Fedora server.  You want to test out the language too.  What should you do?

Prerequisites
Install Groovy; this command should work (assuming your server is configured to work with a yum repository with groovy):  sudo yum -y install groovy
# If your yum repositories do not have Groovy, see this posting.

Procedures
1.  Create a file called hello.groovy with the following five lines:

class Example {
   static void main(String[] args) {
      println('Hello World');
   }
}

2.  Run it like this:  groovy hello.groovy

Leave a comment

Your email address will not be published. Required fields are marked *