Step 1:
When you start eclipse, it asks your for the address of the workspace. Workspace is a folder where eclipse will store all your project files.
Step 2:
To start a new project go to <strong>New->
JAVA project</strong>.
Step 3:
Enter the details of your project i.e your project name.
Step 4:
Create a new class. To do this right click on your project name which is "MyProject" in this case and select <strong>New->Class</strong>.
Step 5:
Enter the name of your class. Click finish.
Step 6: Compiling
To compile, just press the RUN button or the DEBUG button to the left of the run button.
Source:
http://www.mycoding.net/2011/02/compiling-a-java-program-in-eclipse/