javac nofile.java
If your computer responds with
error: Can't read: nofile.java
you're ready to begin. If, on the other hand, it responds
javac: Command not found
or something similar, then you need make sure you have the Java environment properly installed and your PATH configured.Assuming that Java is properly installed on your system there are three steps to creating a Java program:
% javac HelloWorld.java % java HelloWorld Hello World %Under Windows, it's similar. You just do this in a DOS shell.
C:> javac HelloWorld.java C:> java HelloWorld Hello World C:>Notice that you use the
.java
extension when compiling a file,
but you do not use the .class
extension when running a file.On the Mac, you compile files by dragging and dropping them onto the compiler.
For IDEs, consult your product documentation.