DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 3: Understanding Janus
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 2: Understanding Neo4j
  • Introducing Graph Concepts in Java With Eclipse JNoSQL
  • Simplify NoSQL Database Integration in Java With Eclipse JNoSQL 1.1.3

Trending

  • Catching Data Perimeter Drift Before It Reaches Production
  • Building a DevOps-Ready Internal Developer Platform: A Hands-On Guide to Golden Paths, Self-Service, and Automated Delivery Pipelines
  • Jakarta EE 12: Entering the Data Age of Enterprise Java
  • AI Paradigm Shift: Analytics Without SQL
  1. DZone
  2. Coding
  3. Frameworks
  4. Converting a Java Project to a Dynamic Web Project in Eclipse

Converting a Java Project to a Dynamic Web Project in Eclipse

By 
Jason Crow user avatar
Jason Crow
·
May. 06, 08 · Tutorial
Likes (0)
Comment
Save
Tweet
Share
114.7K Views

Join the DZone community and get the full member experience.

Join For Free

To convert a Java Project to a Web Project switch to or open the Resource Perspective of the project, in the root of the project. Open the .project file and make sure the builders and natures are present that are needed for a web project. See the example below, the name should be the name of your project, the most important nodes are the nature children in the natures node:

<projectdescription><name>testProject</name><comment></comment><projects></projects><buildspec><buildcommand><name>org.eclipse.jdt.core.javabuilder</name><arguments></arguments></buildcommand><buildcommand><name>org.eclipse.wst.common.project.facet.core.builder</name><arguments></arguments></buildcommand><buildcommand><name>org.eclipse.wst.validation.validationbuilder</name><arguments></arguments></buildcommand></buildspec><natures><nature>org.eclipse.wst.common.project.facet.core.nature</nature><nature>org.eclipse.jdt.core.javanature</nature><nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature><nature>org.eclipse.jem.workbench.JavaEMFNature</nature></natures></projectdescription>

Once you’ve updated the .project file you can close the file and right click and choose properties on the project. When the properties window opens click on Project Facets. The Facets grid is probably empty, click the Modify Project button. Check the Dynamic Web Module and Java Facets, choose the Java and Servlet version that applies to your project. Click Next and specify the existing or new location of your src and web content directories. Click Finish.

As a final step I would recommend modifying the build path to compile your source directly into your /WEB-INF/classes directory by selecting Java Build Path and modifying the Default output directory.

Now you should be able to create a local tomcat server, or if you’ve already created one you should be able to add the project to the server by right clicking the server and choosing Add and Remove Projects.

Original article at http://greatwebguy.com/programming/eclipse/converting-a-java-project-to-a-dynamic-web-project-in-eclipse/.

 

Web project Java (programming language) Eclipse

Opinions expressed by DZone contributors are their own.

Related

  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 3: Understanding Janus
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 2: Understanding Neo4j
  • Introducing Graph Concepts in Java With Eclipse JNoSQL
  • Simplify NoSQL Database Integration in Java With Eclipse JNoSQL 1.1.3

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook