This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes Error to import javax.servlet.* Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Error to import javax.servlet.*" Watch "Error to import javax.servlet.*" New topic
Author

Error to import javax.servlet.*

paulo cs
Ranch Hand

Joined: Dec 30, 2008
Posts: 34
This is my source code:

This error appear in the lines:

How can I do to use servlet into my Galileo? I use Eclipse Galileo.


Paulo Correa, Desenvolvimento de Software, (55 19)8126-8418
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
Add servlet jar in your eclipse project class path.


SCJP 1.5(97%) My Blog
paulo cs
Ranch Hand

Joined: Dec 30, 2008
Posts: 34
Bingo!! That's right.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
If yous et the "targeted runtime" to an application server (like JBoss for example), then Eclipse should pick up the vendor-provided Jar files automatically. Did you set a targeted runtime for your project?
Meenu Dharma
Greenhorn

Joined: Apr 16, 2010
Posts: 1
Me too get the same error.

error at:

"import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;"


How to Add servlet jar in your eclipse project class path.?

Please help me out.
I'm a beginner.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
Meenu Dharma wrote:Me too get the same error.

error at:

"import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;"


How to Add servlet jar in your eclipse project class path.?

Please help me out.
I'm a beginner.


You need to let Eclipse know that your application is going to run on your particular application server. For example, if you plan to deploy your application to JBoss Application Server, you tell Eclipse this, and Eclipse will include the proper JBoss jar files on the build path.

You do this by setting a Targeted Runtime. This is set in the Project properties. In Eclipse, go to Project -> Properties, then click on the Targeted Runtimes page. On that page, you can select the runtime (application server) your application will use.

By the way, this is actually an Eclipse (IDE) question, not a Servlet question. If you continue to have problems, you should begin your own Topic in the IDE forum.

Good luck.
 
jQuery in Action, 2nd edition
 
subject: Error to import javax.servlet.*
 
Similar Threads
java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName DemoJPA
java don't compile my servlet.
HTTP method GET is not supported by this URL
display the log/output in JSP or HTML page
problem while executing the JAR written using ANT