Raven Dreamer
Raven Dreamer

Reputation: 7140

Eclipse not recognizing my "Main" method

I'm trying to write a "Hello, World" variant program in Eclipse, and I can't seem to be able to run my program.

Here's the code:

/**
 * 
 */
package GreeterPackage;

/**
 * @author Raven Dreamer
 * Prints out "Hello, World" in three languages:
 * English, French, and Spanish.
 */
public class GreeterProg {

    /** 
     * returns "Hello, World" three times, once
     * in English, once in French, and once in 
     * Spanish.
     */
    public static void Main(String[] args){
    /** instances of the three greeter
     * classes so the non-static methods
     * can be called.
     */
    EnglishGreeter eng = new EnglishGreeter();
    FrenchGreeter fre = new FrenchGreeter();
    SpanishGreeter spa = new SpanishGreeter();
    System.out.println(eng.greet());
    System.out.println(fre.greet());
    System.out.println(spa.greet());

}
}

And here's my code for SpanishGreeter (French and English greeter are identical, currently)

/**
 * 
 */
package GreeterPackage;

    /**
     * @author Raven Dreamer
     * Returns "Hello, World!" but in Spanish!
     */
    public class SpanishGreeter extends greeter {

        /**Spanish string of "Hello, World!"
         */
        private String GREET = "¡Hola, World!";

        /** 
         * returns "Hello, World" in Spanish
         */
        public String greet() {
            return GREET;
        }

    }

The code compiles fine with no errors, but when I try to run the program as a java application, I get the following error: enter image description here

So I am left baffled as to what, exactly, the problem is. Am I missing something salient in terms of how I set the project up in the first place?

Upvotes: 2

Views: 1931

Answers (3)

Jonathon Faust
Jonathon Faust

Reputation: 12545

Your main method needs to be a lowercase "main".

Upvotes: 4

jprete
jprete

Reputation: 3759

"main" must be in lowercase only. Java method names are case-sensitive.

Upvotes: 2

Chris Dennett
Chris Dennett

Reputation: 22721

The problem is that you have Main with a capital letter. Java is case-sensitive.

The full method signature is: public static void main(String [] args)

Upvotes: 8

Related Questions