File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Need help for import javax.servlet.* on JBuilder 8 Ent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Need help for import javax.servlet.* on JBuilder 8 Ent" Watch "Need help for import javax.servlet.* on JBuilder 8 Ent" New topic

Need help for import javax.servlet.* on JBuilder 8 Ent

Mirai Chelean

Joined: Jun 27, 2005
Posts: 23
Hi all, thank you for visiting my SOS. I am absolute a java servlet beginner and just start learn via using JBuilder 8 Ent with Tomcat 5.0.28. I look for some helps from java servlet experienced. While i'm coding for the very first of my java servlet programe, "" on JBuilder i got this error. Which i also no idea since i'm follow exactly the same from a tutorial instruction.

"": Error #: 704 : cannot access directory javax\servlet at line 4, column 1
"": Error #: 300 : class HttpServlet not found in class hello.HelloServlet3 at line 16, column 36

Here is the codes for ""

package hello;

import javax.servlet.*;
import javax.servlet.http.*;

/** Simple servlet for testing the use of packages
* and utilities from the same package.
* <P>
* Taken from Core Servlets and JavaServer Pages 2nd Edition
* from Prentice Hall and Sun Microsystems Press,
* © 2003 Marty Hall; may be freely used or adapted.

public class HelloServlet3 extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
String title = "Hello (3)";
out.println(ServletUtilities.headWithTitle(title) +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1>" + title + "</H1>\n" +

My Question is, is it JBuilder don have the build-in Servlet? Am i need to install the so-call directory Javax/servlet by myself? If thats the way, can somebody help me to give me the instructions for it.

Thank you in advance.

The moon light is pouring down on my bedside<br />Like white frost spreading on the ground<br />I look up the bright round moon in the sky<br />And lower my head thinking of my dear hometown
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

You'll need to add servlet-api.jar to your classpath.
It can be found in {tomcat intallation}/common/lib.

You'll have to check with JBuilder's documentation if you don't know how to add libraries to your classpath.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
which feature you'll likely find under "tools->configure->libraries" (at least that's where it is in JB2005).
But the servlet library should already be available as you have the enterprise version so all you need to do is add it to the required libraries for your project from the project properties dialog. In JB2005 you can do so from the "paths" tab, "required libraries" subtab.

It's as Ben pointed out explained quite well in the documentation too.

Mirai Chelean

Joined: Jun 27, 2005
Posts: 23
Thanks to you Ben and Jeroen, ok I'll read the documentation first.
I agree. Here's the link:
subject: Need help for import javax.servlet.* on JBuilder 8 Ent
It's not a secret anymore!