• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setting up Tomcat/Web project in Eclipse

 
Ranch Hand
Posts: 111
PHP Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably this is trivial stuff.... But my last Web project is years ago and I have some troubles starting up again.
I am working on a tutorial site using Eclipse (Helios). I started the project as a JAva project. Ths Eclipse installation appears to be Web-unaware, there is no option to start a Web project.
I remember the right structure of the Web application, using a WEB-INF dir with the web.xml directory. I think the project should be made Web-aware and creating the right structyre manually should not be necessary...
Should I move the whole project to the Tomcat webapps dir and create the WEB-INF manually or is there an Eclipse plugin available to make my project WEb-aware package it into a WAR file and deploy it to the Tomcat container?
Most tutorials on this subjext appear to be pretty outdated so any advice is welcome!


 
Klaas van Gelder
Ranch Hand
Posts: 111
PHP Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This tutorial seems to offer the solution:
http://www.vogella.de/articles/EclipseWTP/article.html

I still wonder how I can "promote" my existing JAva -project to a (dynamic) Web project. Or is it better to just start a new Web project and copy the sourcefiles to the new project?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Or is it better to just start a new Web project and copy the sourcefiles to the new project?


That is what I would do.
 
Klaas van Gelder
Ranch Hand
Posts: 111
PHP Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Peter, I did that
One more issue, I also have to copy the libraries, or better, attach them to the new Web-project.
It appears that there are 2 different lib directories in the web project structure:
Java Resources - Libraries
and
WEB-INF - lib

I know that libraries that are deployed with the WAR file must be placed under WEB-INF/lib
But what is the point of those 2 different folders?
It appears that, if I add an external JAR file in the normal way via Project Proerties - Java Build PAth, it becomes visible under JAva Resources - Libraries.
And one final question, what is the best location for configuration files as the hibernate.cfg.xml file?
Greetings, Klaas
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a guess, but I imagine that you would want to place any JAR files that you want to deploy with the WAR into the WEB-INF/lib directory, and any JARs you need to compile with but you don't want packaged with the WAR (such as the servlet.jar) should be placed into the Java Build Path (they will show up under Java Resource - Libraries).

Why a guess? I always use either Ant or Maven for my builds so I am usually only concerned with the proper JARs being in the Java BUild Path, and with m2eclipse I don't even worry about that since m2eclipse makes declaring dependencies easy and automatically handles the needs of both Eclipse and the Maven build.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic