• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

main(String... args) problems

 
Steve Solomon
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Steve Solomon
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, eclipse had automatically imported a sun main class rather than my local main class
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic