Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2006

Tip: Looking for answers? Try searching our database.

WTF?

Thread view: 
Mad_man_on_a_MissIon - 18 Dec 2006 02:26 GMT
Here is the code:

public class Test {
       public static void main() {
               System.out.println("Testing ....");
       }

}

yet I am getting this error .....Exception in thread "main"
NoSuchMethodError : main

Why?

I run: javac Test.java
       java Test
trippy - 18 Dec 2006 02:45 GMT
In article <1166408804.168543.208980@n67g2000cwd.googlegroups.com>,
Mad_man_on_a_MissIon took the hamburger meat, threw it on the grill, and
I said "Oh Wow"...

> Here is the code:
>
[quoted text clipped - 12 lines]
> I run: javac Test.java
>         java Test

public static void main(String[] args)

There is no no-argument main.

Signature

trippy
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM

NP: "The American Way" -- Sacred Reich

"Now, technology's getting better all the time and that's fine,
but most of the time all you need is a stick of gum, a pocketknife,
and a smile."

-- Robert Redford "Spy Game"

Daniel Pitts - 18 Dec 2006 06:14 GMT
> Here is the code:
>
[quoted text clipped - 12 lines]
> I run: javac Test.java
>         java Test

when you run "java Test". it looks for the class Test (which it finds)
and then looks for public static void main(String[] args), which it
doen't find.  Hence the error.

Try adding String[] args to your parameters.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.