• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat installation

 
tushar parab
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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
 
Siva Masilamani
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you need j2ee.jar file int he classpath
 
Łukasz Suchecki
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • 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
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this FAQ about compiling servlets.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic