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 Beginning Java and the fly likes Errors in compiliation. 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 » Java » Beginning Java
Bookmark "Errors in compiliation." Watch "Errors in compiliation." New topic
Author

Errors in compiliation.

Yuta Lolap
Ranch Hand

Joined: Jun 03, 2012
Posts: 80

I created a fully functional servlet that works and then i send it to a friend he opened it in Eclipse Juno Enterprise Edition and then he get an error saying Imports Cannot Be Resolved. He has JDK7 installed JRE7 and Apache Tomcat. Wat is the issue here? Its saying that there is no class for HTTPServlet also.

The import javax.servlet cannot be resolved
The import javax.servlet cannot be resolved

Why is he getting this error?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60773
    
  65

Moved to beginning Java where compilation issues are discussed.

Is the servelet-api.jar in the build classpath?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Yuta Lolap
Ranch Hand

Joined: Jun 03, 2012
Posts: 80

How do i chek the class path?


Rightick the project->build path->configure build path and then i get to see all the jre7 and webapp libs. Thi is wat i can see in eclipse. I there something missing here?
Yuta Lolap
Ranch Hand

Joined: Jun 03, 2012
Posts: 80

Hw to incude the servlet api? And thanjs for moving me to the right section.
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

javax.servlet is provided usually by the container; Tomcat,JBoss,WebSphere etc.

WP
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

William P O'Sullivan wrote:javax.servlet is provided usually by the container; Tomcat,JBoss,WebSphere etc.

WP


While those products may provide the Servlet classes, that doesn't help here since the problem is a compilation error (as indicated in the subject line and first post).
sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 225
Download/get servelet-api.jar and put it some specific location

Rightick the project->build path->configure build path then import the jar to resolve those

The import javax.servlet cannot be resolved

related errors
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Errors in compiliation.
 
Similar Threads
"import org.apache.http.HttpRequest;" Cannot be Resolved
Question Regarding HTTP Status 500
Pls find the error
Unable to run a simple servlet program
Servlet cannot be resolved.