This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Tomcat installation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Tomcat installation" Watch "Tomcat installation" New topic
Author

Tomcat installation

tushar parab
Greenhorn

Joined: Feb 11, 2009
Posts: 5
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

Joined: Sep 19, 2008
Posts: 385
you need j2ee.jar file int he classpath


SCJP 6,SCWCD 5,SCBCD 5

Failure is not an option.
Łukasz Suchecki
Ranch Hand

Joined: Aug 04, 2009
Posts: 55
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

Check this FAQ about compiling servlets.


[My Blog]
All roads lead to JavaRanch
 
Consider Paul's rocket mass heater.
 
subject: Tomcat installation
 
Similar Threads
context getAttribute code doubt
unable to use TOMCAT 5.5
compiling servlets and jsp and running in tomcat
Problem installing TOMCAT
Difficulty in executing