• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Tomcat Servlet/Jsp and CLASSPATH

 
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I'm having a small problem. Here is my configuration. I'm using Windows XP. I downloaded and installed j2sdk1.4.2_03 under C:\
I then updated the path variable to point to the bin directory of the java installation. This works fine. I then installed the Tomcat 5.0 server by way of the Tomcat 5.0.exe . This worked fine and installed under C:\Program Files\Apache Software Foundation\Tomcat 5.0
Tomcat works fine and I can look at all the example jsp and servlet examples that come with Tomcat. My problem is that I can't write my own Servlets. When I import the javax.servlet. and javax.servlet.httpservlet. packages I get compilation errors siting that the packages don't exist. Do I need to update my Classpath somehow so they see the servlet and jsp packages?
Thanks for any help.
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I read your post now.I have a question for you,hope you can answer it.
in the post you had said that
"look at all the example jsp and servlet examples that come with Tomcat".
I want to know how that is done.I will explain as to what I think is the right way.
In the browser you type in http://localhost:8080 then one gets the home page saying that the web server has installed.
One has to scroll down as hit on the examples link,then one can see a list of files with "execute" and "source",
Now we have to click on "execute" to see all the programs is it??.
Let me know whether this is correct.
Thanks in advance
nash
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The servlet libraries are not part of the SDK so if you are compiling servlets you have to include the servlet.jar file in the classpath.
In Tomcat 4 it is in TOMCAT-HOME\common\lib - I don't know if Tomcat 5 uses another convention.
Note that Tomcat ignores the environment CLASSPATH and has its own rules for finding class libraries.
If you are going to be doing serious servlet development - learn to use ANT to control builds.
Bill
 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
william's approach is correct.
 
reply
    Bookmark Topic Watch Topic
  • New Topic