MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment

Revision 7 as of 2020-05-03 18:26:51
  • Groovy

Groovy

  • https://groovy-lang.org/

  • http://groovy-lang.org/groovy-dev-kit.html

Apache Groovy is a powerful, optionally typed and dynamic language, with static-typing and static compilation capabilities, for the Java platform aimed at improving developer productivity thanks to a concise, familiar and easy to learn syntax

Install

   1 wget https://dl.bintray.com/groovy/maven/apache-groovy-binary-3.0.3.zip
   2 cp apache-groovy-binary-3.0.3.zip ~/
   3 cd  ~/
   4 unzip  apache-groovy-binary-3.0.3.zip 
   5 nano ~/.bashrc
   6 # export GROOVY_HOME=$HOME/groovy-3.0.3
   7 # PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/user/jdk-11.0.2/bin:/home/user/scripts
   8 # PATH=$PATH:/opt/mssql-tools/bin/:$GROOVY_HOME/bin
   9 # export PATH
  10 . ~/.bashrc 
  11 groovysh
  12 # print("aaa")
  13 groovyConsole

groovyc - compiler

  • nano MyClass.groovy

class X{
  int amount
}

def x = new X()
x.amount = 1
println("${x.amount}")
  • groovyc MyClass.groovy

  • java -cp . -jar $GROOVY_HOME/lib/groovy-3.0.3.jar MyClass

  • java -jar $GROOVY_HOME/lib/groovy-3.0.3.jar MyClass

swing - groovy

import groovy.swing.SwingBuilder
import java.awt.BorderLayout as BL

count = 0

def actionPerformedFn(){
  count++; 
  textlabel.text = "Clicked ${count} time(s)."
  println "clicked"
}

def quitFn(){
  System.exit(0) 
}

new SwingBuilder().edt {
  frame(title: 'Frame', size: [300, 300], show: true) {
    borderLayout()
    textlabel = label(text: 'Click the button!', constraints: BL.NORTH)
    button(text:'Click Me', actionPerformed: {actionPerformedFn()}, constraints:BL.WEST)
    button(text:'Quit', actionPerformed: {quitFn()}, constraints:BL.EAST)
  }
}
  • groovyc swing.groovy
  • java -cp .:$GROOVY_HOME/lib/groovy-3.0.3.jar:$GROOVY_HOME/lib/groovy-swing-3.0.3.jar swing
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01