I use Ubuntu. I open a bash and type sudo apt-get install sun-java6-jdk sun-java6-bin sun-java6-jre
It downloads, configures etc. Then I use gedit to write a hello world java program. I save it to /home/user/Documents and use the standard javac and java commands to run the java program. I believe the procedure is similar. Make sure you are in the directory where your source file is stored before you use javac and java commands.