• 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Tomcat installation

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have installed Tomcat on my pc(Windows XP) but when i try to compile the servlet code it gives me an error that package javax.servlet does not exists. the packagesI have imported are
java.io.*;
import javax.Servlet.*;
import javax.Servlet.http.*;
I have set 4 environment variables
CATALINA_HOME :C:\Program Files\Apache Software Foundation\Tomcat 6.0
CLASSPATH :C:\Program Files\Apache Software Foundation\Tomcat
JAVA_HOME :C:\Program Files\Java\Jdk1.6.0_18
PATH :C:\Program Files\Java\Jdk1.6.0_18\bin;
Location of the sourcecode file HelloWorldServlet is as follows
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Examples\WEB-INF\classes
Can anyone suggest the solution. Thank you
 
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you need j2ee.jar file int he classpath
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

tushar parab wrote:I have installed Tomcat on my pc(Windows XP) but when i try to compile the servlet code it gives me an error that package javax.servlet does not exists. the packagesI have imported are
java.io.*;
import javax.Servlet.*;
import javax.Servlet.http.*;
I have set 4 environment variables
CATALINA_HOME :C:\Program Files\Apache Software Foundation\Tomcat 6.0
CLASSPATH :C:\Program Files\Apache Software Foundation\Tomcat
JAVA_HOME :C:\Program Files\Java\Jdk1.6.0_18
PATH :C:\Program Files\Java\Jdk1.6.0_18\bin;
Location of the sourcecode file HelloWorldServlet is as follows
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Examples\WEB-INF\classes
Can anyone suggest the solution. Thank you


Make a quick review of your knowledge of SCJP ;)
If you want to include jar file into classpath you need to add jar file into classpath and not the directory in which you have it.
so you should add servlet-api.jar (with it access path) to the classpath
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check this FAQ about compiling servlets.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic