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

import Statement  RSS feed

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am using Eclipse 3.2 Version. I am trying the import the javax.servelt.*. But throwing the error like unresolve statement. Do i need to any jar files. java.io.* statement is working fine.

Adsumalli.
 
Ranch Hand
Posts: 2410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.servlet is not part of the standard J2SE. It is part of J2EE. You can also find the .jar file with the package in it if you download Tomcat.
 
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aside from the typo in "servlet," note that javax.servlet is in Java Enterprise Edition (EE), and not in the Standard Edition (SE). Have you installed the Enterprise Edition (or at least something like Tomcat that provides the servlet packages)?
 
Ram Adsumalli
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I know that servlet is not under J2SE. I installed Tomcat 6.0 in my desktop. Do i need to add any jar files in Eclipse related to J2ee. If yes where in eclipse i need to add jar files.

Thanks
Adsumalli.
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reference them from your project. See the project options...

And of course import javax.servelt.*; isn't going to work no matter what
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Raghu Adsumalli:


Do i need to add any jar files in Eclipse related to J2ee. If yes where in eclipse i need to add jar files.



Answer is YES you need to add servlet-api.jar or servlet.jar into your project.

go to the project properties and select the Java build path option from the left panel then going to the libraries tab to add your jar file there.
 
Does this tiny ad smell okay to you?
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!