View on GitHub


:green_book: Basic codes and Useful snippets for Data Handling :sparkles:


What is Groovy ?

As Python, Groovy is also a Dynamic language and the superset of java. The syntax of groovy is also like python and an advantage it doesn’t need indentation. Normal JAVA JVM is used to compile groovy scripts with a single jar groovy-all.jar.

java -cp .:groovy-2.4.13.jar groovy.ui.GroovyMain Code.groovy

A Groovy script can be run by java by adding classpath like shown above code. Refer More with the official Groovy doc.

How to setup in local ?

Download the latest Groovy binary from the official page. Unzip:

unzip apache-groovy-binary-*.*.*.zip

Place this code on ~/.bashrc or run directly on console.


export GROOVY_HOME=/path/to/uzip

How to run this Dynamic java ?

Normal print line code like print by PYTHON, can be executed from the file hello.groovy,

println "Hello_world"

To run this code execute the cli command,

groovy hello.groovy

How to Package this ?

// File: Sample.groovy
package io.github.bhanuchander210.learnGroovy
println 'Hello from Groovy'

Initially This packages should be compiled from the command groovyc and it can be run from java like shown below.

$ groovyc Sample.groovy
$ java -cp .:$GROOVY_HOME/embeddable/groovy-all-1.6.5.jar io.github.bhanuchander210.learnGroovy.Sample
Hello from Groovy

For Groovy and Java Packaging discussed inside the Chapter 1. Basic Initiatives/GROOVY-JAVA

Thanks to :

Notes :

This repository may covers simple basic areas. I am collecting these areas with quick understandable code-snippets, whenever i have free times. If any area not covered it will be updated or help me to improve this repo by your contribution.