Welcome to Dream.In.Code
Getting Java Help is Easy!

Join 132,642 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,094 people online right now. Registration is fast and FREE... Join Now!




Error Message: The system couldn't find a suitable main method or

 
Reply to this topicStart new topic

Error Message: The system couldn't find a suitable main method or

nrp88
post 11 Oct, 2008 - 07:32 AM
Post #1


New D.I.C Head

*
Joined: 19 Sep, 2008
Posts: 30

Everytime I try and Run (execute) this code, it gives me this error message. " The system couldn't find a suitable main method or htm(l) file in the active project" "

This happens now whenever I try and run anything I have made in the past, and this code below, which does compile correctly and according to my professor, should run correctly. Is there something I can do to the program to fix this error?

Here is the code that will not work, but compiles perfectly.

CODE
class MainApplication {

    public static void main(String args[]) {
        
        Dog fido = new Dog();    
        
        fido.bark(5);
        
    }
}

// Class Dog
class Dog {

       public void bark(int iterations){
           
           int i = 0;
           
           while (i < iterations) {
           
            System.out.println("ruff");
            
            i++;

          }
    }

}


PLEASE HELP ME!
User is offlineProfile CardPM

Go to the top of the page

pbl
post 11 Oct, 2008 - 07:43 AM
Post #2


D.I.C Lover

Group Icon
Joined: 6 Mar, 2008
Posts: 2,982



Thanked 190 times

Dream Kudos: 75
My Contributions


If your code is in a file named MainApplication.java
and you do at the console prompt:

> javac MainApplication.java
> java MainApplication

it should work... and all filename letters are case sensitive
User is offlineProfile CardPM

Go to the top of the page

Gloin
post 11 Oct, 2008 - 07:43 AM
Post #3


On MeD.i.Cation

Group Icon
Joined: 4 Aug, 2008
Posts: 717



Thanked 46 times
My Contributions


Did you save the two classes in separate files? What about the filenames, are they the same as the class-names?
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 04:38AM

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month