|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Q: main not availableI'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 G. Ralph Kuntz, MD
|
|
|
Re: Q: main not availableHi
try: public static void main(def args) On Wed, Aug 13, 2008 at 7:30 PM, grkuntzmd <grk@...> wrote:
|
|
|
Re: Q: main not availableExactly. The minimum signature that java will see is
static void main(args) { } Thanks, Chris On Wednesday 13 August 2008 13:33:38 Martin Stephan wrote: > 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<http://www.nabble.com/Q%3A-main-not-available-tp18967677p189676 > >77.html> Sent from the groovy - user mailing list > > archive<http://www.nabble.com/groovy---user-f11867.html>at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Q: main not availableI tried
#!/usr/bin/env groovy
static main(def args) {
println System.getProperty("java.version")
}
and using "groovy Main.groovy" it printed "1.6.0_10-rc" and with "java Main", nothing (no error though).
G. Ralph Kuntz, MD
|
|
|
Re: Q: main not availableChris Reeves schrieb:
> Exactly. The minimum signature that java will see is > > static void main(args) { > } the minimum signature varies from tool to tool. Some tools look for exactly "static void main(String[])", others are satisfied if there is a "static main(args)", but maybe the java command requires "static void main(args)". For the Groovy command the minimal form should be ok. bye blackdrag -- Jochen "blackdrag" Theodorou The Groovy Project Tech Lead (http://groovy.codehaus.org) http://blackdragsview.blogspot.com/ http://www.g2one.com/ --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Q: main not availableTo be specific, Sun Java 1.6.0_06 java command on linux requires at least that
signature. I would think the same jre on other platforms would be the same, but icedtea, et al are probably a little bit different even on the same platform. Thanks, Chris On Wednesday 13 August 2008 14:29:20 Jochen Theodorou wrote: > Chris Reeves schrieb: > > Exactly. The minimum signature that java will see is > > > > static void main(args) { > > } > > the minimum signature varies from tool to tool. Some tools look for > exactly "static void main(String[])", others are satisfied if there is a > "static main(args)", but maybe the java command requires "static void > main(args)". For the Groovy command the minimal form should be ok. > > bye blackdrag --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free embeddable forum powered by Nabble | Forum Help |