File . java not found

Asked

Viewed 130 times

0

This is my first time, I made a simple println.

My code was exactly:

class teste {
    public static void main(String[] args) {
        System.out.println("oi");
    }
}

No error appears, but when I go to the terminal and type javac teste.java...!

Terminal

  • And what’s the problem ?

  • A tip: Do not confuse Java with Javascript, they are two totally different languages. The name is similar only because of the stupidity of who gave the name to Javascript (which came later), because it is something with little or no relation to Java. Originally you had put the Javascript tag on the question instead of Java, but I’ve already arranged it.

1 answer

3


You are running the command javac from the wrong folder. First navigate to the correct folder, which is the folder where your file .java is. And then turn the javac.

To navigate between folders on the linux terminal, use the command cd.

Also, remember that class names should start with uppercase letters.

  • Okay, I did, but a new question came up: how to access folders in the terminal with space bar( example: Java files) I had to change the name because of that( not that it makes much difference) I thank you from now

  • @Henriquebergs If the folder has spaces, you put its name in quotes. For example cd "Minha pasta".

Browser other questions tagged

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