Unix Way
Open up the terminal. Type javac. This is the java compiler. Type java. This is the java runtime environment. Type emacs. This is a (great) text editor. Now to use it all together. Open 2 (or maybe 3) terminal windows. Use cd and mkdir to get yourself a nice directory to work in (in both terminal windows). In one window type emacs. Open the file with the name you want to work on (Ctrl-X Ctrl-F <filename>). Type whatever you are meant to type. Save the file (Ctrl-X Ctrl-S). In the other window type javac <filename> If no errors appear your java has been compiled. Type java <filename-without-the extension> to run the java.