Install java
Mac OS X
Java should already be installed.
Linux and etc
Depends on distribution.
Windows
To download the Java Runtime Environment, go to the Sun website and click on the "Get Java Software" button in the top right-hand corner of the page. Also, if you want to verify that Java has already been installed, click on the "Get Java Software" button.

To verify Java installation, click "Manual download" and run "Verify installation". If you have Java, then the Java version installed on your computer will be shown.
If you do not already have Java on your computer, click on the "Download Now" button on the following page.

On the next page, you can begin the download by clicking on the "Begin Download" button. Below the "Begin Download" button are detailed instructions on the steps that you should follow to download and install the Java Runtime Environment. The instructions will vary according to the type of web browser and operating system that you are using.

After following the instructions on the download page and downloading and installing the Java Runtime Environment, a message like the following should appear. Click on the "Finish" button to exit.

Finally, you can verify the installation by clicking on the "Verify Installation" button. To verify the installation properly, you will need to close and reopen your web browser and then return to the web page and click on the "Verify Installation" button.

If verification is successful, you will see a message such as the following.

References
Java is open source, so compatible Java SE implementations are available also from IBM, BEA, GNU and so on.
Here are benchmarks with GUI and without GUI, for helping your choice. Your data is appreciated.