Java - Create a Dynamic Web Project in Eclipse

Almost always, you will be deploying your Java application to an application server such as JBoss, Tomcat, or WebSphere. When possible, I like to ensure that Eclipse is configured with the same Java Runtime Environment (JRE) as the application server. For example, if the application server is using Java Runtime Environment 8u311 then I would download and install Java Runtime Environment 8u311 on my system running Eclipse.

Check out my articles:


In Eclipse, select  File > New > Dynamic Web Project. If you do not have an option to select Dynamic Web Project, select Help > Install New Software, select a site from the drop down, and then select the following:

  • Eclipse Java EE Developer Tools
  • Eclipse Java Web Developer Tools
  • Eclipse Web Developer Tools
  • JST Server Adapters and JST Server Adapters Extensions (these are needed so that you can run your Dynamic Web Projects on an application server such as Tomcat, JBoss, or WebSphere in Eclipse)

Give your project a name, such as myAppsetup a server target runtime, and select Next.


At the Java prompt, select Next. At the Web Module prompt, check Generate web.xml deployment descriptor and select Finish.


In the left panel of Eclipse, right-click on myApp and select New > JSP File. Select the WebContent folder, give the file a name such as index.jsp, and select Finish.


You may need to right click on the project, select Properties, select Java Build Path, and add javax.servlet-api-<version>.jar.

You may need to also right click on the project, select Properties, select Deployment Assembly, and add javax.servlet-api-<version>.jar. This is only needed if you are going to be exporting the WAR and deploying the WAR onto an Application Server (e.g. JBoss, Tomcat, WebSphere).


The index.jsp file should now be listed under the WebContent folder in the left panel of Eclipse. Add the text Hello World to the index.jsp file.


Note: By naming the file index.jsp, there will be no need to modify the welcome-file-list section of the web.xml file, because there should also be a default document for index.jsp.


If you have added a server to Eclipse, you can also run the application in Eclipse. For example, if Tomcat has been added to Eclipse, select the green play button and select Run on Server.


Select your server and select Finish.


Your simple Hello World application should now be displayed in Eclipse.


If you have not added a server to Eclipse, export your application, and then deploy your application on an application server.


Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter a3b93 in the box below so that we can be sure you are a human.