I went through all of this, but still run into the
java -classpath . HelloWorld
> Error: Could not find or load main class HelloWorld
> Caused by: java.lang.ClassNotFoundException: HelloWorld
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
javac HelloWorld.java
runs without problems (before calling java HelloWorld
)
Java version:
java --version
> java 11.0.1 2018-10-16 LTS
> Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
> Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
all commands executed in terminal from the directory, where the code is.
Operating System: MacOS Monterey 12.3.1 (21E258)
What can I do to get java up and running from command line?