Results 1 to 3 of 3
  1. #1
    snozzla is offline Member
    Join Date
    Mar 2011
    Posts
    4
    Rep Power
    0

    Default Could not find the main class: ShowBorderLayout. Program will exit.

    Hello! I have started to learn about GUI Basics from my book and typed this into Eclipse as usual. But it doesn't work.
    All the other examples from the book have worked so far but the frames, flowlayout,gridlayout,buttonlayout examples have not.
    I do not know why. But I get some error when compiling & running.

    Could not find the main class: ShowBorderLayout. Program will exit.

    Java Code:
    import javax.swing.*;
    
    public class MyFrameWithComponents {
    	public static void main(String[] args) {
    		JFrame frame = new JFrame("MyFrameWithComponents");
    		
    		//add a button into the frame
    		JButton jbtOK = new JButton("OK");
    		frame.add(jbtOK);
    		
    		frame.setSize(400,300);
    		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		frame.setLocationRelativeTo(null); //center the frame
    		frame.setVisible(true);
    	}
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

  3. #3
    snozzla is offline Member
    Join Date
    Mar 2011
    Posts
    4
    Rep Power
    0

    Default

    Oh thanks for pointing that out, I am so ashamed I did not see that. Hehe. Thank you! Now I can move on.:o

Similar Threads

  1. Could not find the main class, program will exit.
    By CourseLanguage in forum New To Java
    Replies: 18
    Last Post: 05-03-2011, 10:14 PM
  2. Could not find the main class, program will exit
    By grottesco in forum New To Java
    Replies: 7
    Last Post: 11-03-2010, 06:51 AM
  3. Could not find the main class, program will exit.
    By aryubi in forum New To Java
    Replies: 39
    Last Post: 02-19-2010, 10:02 AM
  4. Could not find the main class. Program will exit.
    By XSROSSITER in forum New To Java
    Replies: 0
    Last Post: 01-30-2010, 04:17 AM
  5. Could not find the main class. Program will exit.
    By Carrier in forum New To Java
    Replies: 1
    Last Post: 04-22-2009, 02:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •