This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

javax.servlet package not found error  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I like to do project in java servlet in tomcat. I have installed jdk1.7.0_03 version and Apache Tomcat 7.0.22 version and also i set classpath for both of them.

this is my classpath value
"C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\bin;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\lib\annotations-api.jar;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\lib\tomcat-api.jar;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\lib\servlet-api.jar;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\lib\jsp-api.jar;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\lib\el-api.jar;C:\Servlets+JSP;C:\Program Files (x86)\Java\jdk1.7.0_03;.;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\lib\*;

My java program was running successfully but
im getting javax.servlet package not found error while running servlet program....
I dont know what,s the problem... someone help me to get rid of this problem
What s the mistake i did
 
Bartender
Posts: 20775
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Dhivya!

The javax.servlet servlet classes reside in 2 places: the servlet-api.jar and in the Tomcat server internal jars.

When compiling a J2EE webapp, you have to have the servlet-api.jar in the compile classpath, however, you do not include copies of it or any other library in the TOMCAT_HOME/lib directory in the WAR that you produce. Tomcat will supply them at run time.

Beyond that, as long as what you have produced is a valid WAR (as defined by the J2EE spec) and properly deployed it into Tomcat, then launched Tomcat using the standard startup scripts that come with Tomcat, everything should resolve properly.
 
Dhivya Imayavaramban
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
I didnt get the output yet.... What i have to deploy into tomcat....
I have a doubt actually..... am i using the correct version of java and tomcat?
 
Tim Holloway
Bartender
Posts: 20775
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your JVM and Tomcat releases should be compatible. You do not have to set explicit classpaths, but you do need to set the JAVA_HOME environment variable to point to the JDK directory before launching Tomcat.

To deploy a webapp into Tomcat, you must create it in WAR format, as documented by the J2EE specification. A WAR file can then be deployed by copying it into the TOMCAT_HOME/webapps directory.
 
I carry this gun in case a vending machine doesn't give me my fritos. This gun and this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!