permaculture playing cards*
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "main(String... args) problems" Watch "main(String... args) problems" New topic
Author

main(String... args) problems

Steve Solomon
Greenhorn

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
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Hi,

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
Greenhorn

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
Greenhorn

Joined: Jun 22, 2011
Posts: 4
Thank you, eclipse had automatically imported a sun main class rather than my local main class
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: main(String... args) problems