Compiling and running a simple program

Assuming you have the source file containing the following simple Java program:

class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, world!") ;
you can compile the program with:
$ javac
which should (if all goes well) produce the output class file HelloWorld.class.

You can then run that class file with:

$ java Helloworld