WTF?

Discussion in 'Java' started by Mad_man_on_a_MissIon, Dec 18, 2006.

  1. 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
     
    Mad_man_on_a_MissIon, Dec 18, 2006
    #1
    1. Advertising

  2. Mad_man_on_a_MissIon

    trippy Guest

    In article <>,
    Mad_man_on_a_MissIon took the hamburger meat, threw it on the grill, and
    I said "Oh Wow"...

    > 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
    >
    >


    public static void main(String[] args)

    There is no no-argument main.

    --
    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"
     
    trippy, Dec 18, 2006
    #2
    1. Advertising

  3. Mad_man_on_a_MissIon

    Daniel Pitts Guest

    Mad_man_on_a_MissIon wrote:
    > 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


    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.
     
    Daniel Pitts, Dec 18, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joe Van Meer

    wtf am I doing wrong?

    Joe Van Meer, May 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    380
    Joe Van Meer
    May 6, 2004
  2. Ishmael Rufus

    WTF? Spam on this newgroup?

    Ishmael Rufus, May 2, 2005, in forum: Java
    Replies:
    14
    Views:
    592
    Darryl Pierce
    May 8, 2005
  3. Psymaster

    WTF is this?

    Psymaster, Aug 1, 2003, in forum: C++
    Replies:
    3
    Views:
    474
    Psymaster
    Aug 2, 2003
  4. Maciej Mrozowski
    Replies:
    1
    Views:
    5,877
    tkaczerski
    Jan 9, 2008
  5. Noah Roberts

    wtf is this?

    Noah Roberts, Sep 29, 2003, in forum: C Programming
    Replies:
    10
    Views:
    749
    Noah Roberts
    Sep 30, 2003
Loading...

Share This Page