Sounds like you don't have a JDK in your project build path, or the one you have is invalid. Right click on your project, go to Properties>Java Build Path, click on the libraries tab and see what's in there. You will need a JRE SYstem Library listed. If you have one edit it and see that where it is installed is valid.
I presume that you have java [JDK, that is] installed on your machine. If that is correct, then proceed as follows:
Open Eclipse, and in the "Window" menu;
Preferences > Java > Installed JREs
On the right hand side, click on the "Add" button, select "Standard VM", and in the resulting pane, browse and select the JDK installation directory. [I understand that the heading says "Installed JREs", but selecting a JDK here is always the better idea].
Once all this is done, try out a simple hello world program after creating a java project in eclipse, and see if that is working correctly.
This will ensure that you have a good working setup. Now, for developing servlets, you'll need the servlet-api.jar in your classpath as well. Hope that helps.
It's never done THAT before. Explain it to me tiny ad: