Giter Club home page Giter Club logo

learn_groovy's Introduction

Learn_Groovy

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.

Environment

export GROOVY_HOME=/path/to/uzip
export PATH=$PATH:$GROOVY_HOME/bin

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.

learn_groovy's People

Contributors

bhachanms avatar bhachauk avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.