For most Groovy scripts I use, I simply run the script from its Groovy source code as-is and allow the compilation to take place implicitly. However, it can be helpful at times to use groovyc to compile Groovy code into .class files and then execute those .class files via the normal Java launcher (java). The groovyc compiler is also a necessity when mixing Groovy and Java code in the same compilation step.
For traditional Java, such as the HelloWorld.java class shown next, javac is used to compile the class into a .class file and then java is used to run that class file. The example class is shown first followed by a screen snapshot showing the compilation and execution process.
import static java.lang.System.out;
public class HelloWorld
public static void main(String args)
out.println("Hello, " + args + ", the time is " + new Date());