« Return to Thread: Q: main not available

Re: Q: main not available

by Martin Stephan :: Rate this Message:

Reply to Author | View in Thread

Hi

try: public static void main(def args)

On Wed, Aug 13, 2008 at 7:30 PM, grkuntzmd <grk@...> wrote:

I'm a Groovy-Newbie.

If I run the following program using "groovy Main.groovy", it runs fine. If I compile it and type "java Main" I get the following error:

Exception in thread "main" java.lang.NoSuchMethodError: main
--- cut here ---
#!/usr/bin/env groovy

class Main {
    static main(args) {
        println System.getProperty("java.version")
    }
}
--- cut here ---

Any ideas?

BTW, If I change to "static void main(String[] args)" it works in both, so I guess I can type a few extra characters.


View this message in context: Q: main not available
Sent from the groovy - user mailing list archive at Nabble.com.

 « Return to Thread: Q: main not available