This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Reply 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: 639
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: 639
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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Error to import javax.servlet.*
 
Similar Threads
problem while executing the JAR written using ANT
display the log/output in JSP or HTML page
java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName DemoJPA
HTTP method GET is not supported by this URL
java don't compile my servlet.