Java failed to locate the main class of my program

Asked

Viewed 141 times

-2

Hello, I am beginner in java I made a very simple project hello World and I am compiling in the terminal and when I put to run gives error.

Name of the file ta Primeiroprogama.java

package primeiroprogama;

public class PrimeiroProgama{
    public static void main (String [] args){
        System.out.print("Olá World");
    }
}

Error: Unable to find or load main class First range Caused by: java.lang.Noclassdeffounderror: primeiroprogama/Primeiroprogama (Wrong name: Primeiroprogama)

1 answer

0

As you are studying and learning now, remove the "package" line and try again.

At the time of compiling:

java PrimeiroPrograma
  • 2

    It’s "progam" for him. I was going to tell him to check the spelling, but he wrote it the same on every occurrence, including a statement, so maybe that’s not the problem.

  • 1

    Must be a chic model of nomenclature relating English to the Greek alphabet: Professional Gamma -> Pro Gama => Progama

Browser other questions tagged

You are not signed in. Login or sign up in order to post.