You can download the Java software from the link on the course home page You want the "JDK" (Java SE Development Kit) not "JRE".
To make sure it worked, type javac -version on the command line (Terminal for Mac, CMD for Windows, bash or other shell for Unix). You should get a message with the version number (preferably 1.8, a.k.a. Java 8, or higher).
Many Mac OS systems have Java already installed. Check that you have a fairly recent version of Java. If not, then download a fresh version as above.
If you are having trouble running java, make
sure the CLASSPATH environment variable is not set. Some other
program installations may have set it automatically. In Windows, the
environment variables are in the System control panel under
Advanced / Environment Variables. You may also want to add the
directory where the javac program lives (typically something like
to your PATH environment variable.
You can add also this directory to your PATH variable temporarily,
just in a single window, by typing
PATH=%PATH%;C:\...etc... on the command line.