Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: New to Java....still learning...Help Required

  1. #1
    Junior Member
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile New to Java....still learning...Help Required

    Hi i'm trying to grasp Java via reading tutorials..

    I'm trying to setup a small quiz but getting nowhere..

    My code is below
    ================================================== =======
    package footballquiz;

    import java.applet.*;
    import java.awt.*;
    import javax.swing.*;

    public class Main {
    private static void createAndShowGUI() {
    //Create window
    JFrame frame = new JFrame("main");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);

    JLabel emptyLabel = new JLabel("main");
    emptyLabel.setPreferredSize(new Dimension(175, 100));
    frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);

    //Display Window
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    }
    });
    }
    }
    ================================================

    when running i get the following error..

    "Footballquiz.Main class wasn't found in FootballQuiz project"

    Can anyone shed light on this please.... and point me in the right direction...

    Thanks in advance


  2. #2
    Member
    Join Date
    May 2010
    Posts
    36
    Thanks
    0
    Thanked 13 Times in 12 Posts

    Default Re: New to Java....still learning...Help Required

    Quote Originally Posted by muraduk View Post
    "Footballquiz.Main class wasn't found in FootballQuiz project"

    when you start a java program the jvm is looking for a method main with exactly this signature

    public static void main(String[] args)


    this is the entry-point of your program. if the jvm doesn't found this default entry-point an error is thrown and the execution is aborted.

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: New to Java....still learning...Help Required

    See second thread at http://www.javaprogrammingforums.com...-required.html

Similar Threads

  1. Java newbie...Help required
    By muraduk in forum What's Wrong With My Code?
    Replies: 3
    Last Post: August 12th, 2010, 03:15 PM
  2. Hello. Just Learning Java For Fun..
    By derekeverett in forum Member Introductions
    Replies: 1
    Last Post: March 18th, 2010, 04:24 PM
  3. :!! Unsure how to set this up/ Still learning java loops!!!!!
    By raidcomputer in forum Loops & Control Statements
    Replies: 4
    Last Post: September 29th, 2009, 10:28 AM
  4. Java Learning Resource for Beginners
    By Freaky Chris in forum The Cafe
    Replies: 1
    Last Post: April 29th, 2009, 04:57 AM
  5. 15, Loves ICT, learning Java coding.
    By Sergant Mitch in forum Member Introductions
    Replies: 1
    Last Post: September 20th, 2008, 09:40 AM