File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes compiling problem with HF JSP book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "compiling problem with HF JSP book" Watch "compiling problem with HF JSP book" New topic

compiling problem with HF JSP book

Fritz Urling

Joined: Jan 09, 2006
Posts: 13
i'm confused...

i have written the file. i put it in my MyProjects/Beer-v1/src/com/example/web directory.

from the Beer-v1 directory, i enter the following:

H:\MyProjects\Beer-v1>javac -classpath \tomcat\apache-tomcat-5.5.17\common\lib\servlet-api.jar -d classes src\com\example\web\

and it compiles.

the book, however, says to use this:

H:\MyProjects\Beer-v1>javac -classpath \tomcat\apache-tomcat-5.5.17\common\lib\servlet-api.jar:classes:. -d classes src\com\example\web\

this gives me the following:

src\com\example\web\ package javax.servlet does not exist
import javax.servlet.*;
src\com\example\web\ package javax.servlet.http does not exist
import javax.servlet.http.*;

what am i doing wrong?

here is my source code:

package com.example.web;

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

public class BeerSelect extends HttpServlet {

public void doPost (HttpServletRequest request,
HttpServletResponse response )
throws IOException, ServletException {
response.setContentType ("text/html");
PrintWriter out = response.getWriter();
out.println("Beer Selection Advice<br>");
String c = request.getParameter("color");
out.println("<br>Got beer color " + c );


Surendra Kumar
Ranch Hand

Joined: Jul 04, 2006
Posts: 236
Looks like you're compiling your Java source on Windows. And you have to use semicolon( to seperate the classpath directories instead of colon ( .
Fritz Urling

Joined: Jan 09, 2006
Posts: 13
now i feel like an idiot.

I agree. Here's the link:
subject: compiling problem with HF JSP book
It's not a secret anymore!