Error: Could not find or load main class OlaWorld.java [duplicate]

-3

I'm trying to compile and run a "hello world" in Java from the command line.

My code is:

public class OlaMundo{
  public static void main(String[] args){
    System.out.println("Oi , funcionou");
  }
}

I'm trying to run through the command line, so

$> java OlaMundo.java

This error is being shown

  

Error: Could not find or load main class OlaWorld.java

    
asked by anonymous 13.07.2018 / 14:02

1 answer

0

You must first compile with the command javac :

javac OlaMundo.java

And then run with the command java :

java OlaMundo

    
13.07.2018 / 14:23