Trying to get the following script:
class MyClass {
static void main(String... args) {
println "Hello ${args[0]}"
}
}
To run like Java with: java MyTest John for example.
Reading the groovy docs on scripts with main I was under the impression I could to the following to achieve my goal:
- Run
groovyc MyTest.groovy - Run
java MyTest John
I was even under the impression that I could leave just the body of the main function and still be able to compile until a class that extends from Script...
I can run the script with groovy MyTest.groovy John and (after compiling with groovyc) groovy MyTest John
How can I accomplish my goal? What am I doing wrong?