Results 1 to 2 of 2
  1. #1
    kkid is offline Senior Member
    Join Date
    Jul 2012
    Posts
    233
    Rep Power
    3

    Default No main class found

    I am trying to run my program from Netbeans but am getting a window appear saying that there is no main class.
    I read that the issue is from having no main method but I do have this.


    My code is pretty simple:

    Java Code:
    import java.util.Scanner;
    
    class PrintInput {
        
    public static void main(String[] args) {
        Scanner InputCheck = new Scanner(System.in);
        System.out.println( InputCheck.nextLine() );
    }
    
    }

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,785
    Rep Power
    7

    Default Re: No main class found

    This sounds like a Netbeans issue. Can you compile and run your class from the command line? How many other classes do you have in your project? Have you set the properties of the project so it knows which class to run when you click the "run" command? If memory serves, you should be able to right click on your class and select run from there.

Similar Threads

  1. Main Method not found in class
    By HinaKhan in forum New To Java
    Replies: 6
    Last Post: 06-22-2012, 02:34 PM
  2. main method not found in class
    By eLancaster in forum New To Java
    Replies: 5
    Last Post: 02-09-2011, 08:48 AM
  3. Main Class not found
    By Draugnar in forum New To Java
    Replies: 3
    Last Post: 01-09-2010, 03:12 AM
  4. main class not found
    By abhijit in forum Networking
    Replies: 3
    Last Post: 10-01-2009, 09:05 AM
  5. No main class found error
    By jhering1986 in forum New To Java
    Replies: 17
    Last Post: 03-28-2009, 02:34 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
  •