To compile Foo.java: javac Foo.java
To run the program : java Foo
Why compiler needs .java suffix but interpre
Adding to David Zaslavsky's explanation:
The java source code are not necessarily from .java files either. We can have a compiler that takes source code from difference character streams, as in the API javax.tools.JavaCompiler.
The cmd line util javac happens to be working with file sources only, so it desires file paths.