Class not found in Windows CMD build

Asked

Viewed 309 times

1

I am unable to run my JAVA algorithms through the Windows 8.1 terminal .

It turns out that there is always a class error not found, I already put the . class files together with . java and still can’t find.

What do I do to fix?

Follow some prints to illustrate my doubt.

All files together in the same folder

Arquivos juntos...

Running the javac system.java command on CMD Comandos...

PS: I already used the command javac system.java person.java student.java and NOTHING.

  • 2

    In the archive aluno.java, the class "student" is defined as Aluno or aluno?

  • Probably @Viníciusgobboa.deOliveira is right, the class should be Student.

  • Aki is the code of my class: http://prntscr.com/8mmgg1

1 answer

1


To commpilar the classes you must save the class with the same name as you will use to call the class by cmd.

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello, World");
    }
}

You should call the cmd that way:
javac Helloworld.java

It is possible to name a class with any language supported name. But it is interesting to follow some adopted rules:

Every class should start with a capital letter ,if the name of a class is composed of more than one word, the first letter of each word should be capitalized. Do not declare a class with any special character (@, #, $, %, &, *, _, etc...). The word selected should reflect the purpose of the class.

Always put the class in some package.

Browser other questions tagged

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