my dog learned polymorphism
The moose likes Beginning Java and the fly likes main(String... args) problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "main(String... args) problems" Watch "main(String... args) problems" New topic

main(String... args) problems

Steve Solomon

Joined: Jun 22, 2011
Posts: 4
Im getting a error for the following function in class called ApplicationRunner on
the line that calls main in my Main class:
The method main(String[]) in the type Main is not applicable for the
arguments (String, String, String, String)

even though main is declared public static void main(String ... args)
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199


Welcome to JavaRanch!

Any chance you're compiling ApplicationRunner with a JDK 1.4 compiler, or a newer compiler in a JDK 1.4 compatibility mode? The varargs syntax wasn't introduced until Java 5.

[Jess in Action][AskingGoodQuestions]
Steve Solomon

Joined: Jun 22, 2011
Posts: 4
Wow thank you very much for the kind welcome.

I am running java 1.6 on snow leopard and my project is in eclipse.
Luigi Plinge
Ranch Hand

Joined: Jan 06, 2011
Posts: 441

Eclipse doesn't use the standard version of javac, since it is built on IBM's VisualAge, which allows for incremental compilation (and compile times are reduced). So it won't necessarily correspond to your installed JDK.

Make sure you've re-compiled the class you're calling.
Check your project compiler properties, and make sure you're not using an ancient version of Eclipse.
Try compiling using javac from the command line.

If it still doesn't work, distill the problem down to a short example demonstrating the behaviour and post here.
Steve Solomon

Joined: Jun 22, 2011
Posts: 4
Thank you, eclipse had automatically imported a sun main class rather than my local main class
I agree. Here's the link:
subject: main(String... args) problems
It's not a secret anymore!