It's not a secret anymore!*
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 Android Security Essentials Live Lessons this week in the Android 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
Author

compiling problem with HF JSP book

Fritz Urling
Greenhorn

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

i have written the BeerSelect.java 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\BeerSelect.java


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\BeerSelect.java


this gives me the following:

src\com\example\web\BeerSelect.java:3: package javax.servlet does not exist
import javax.servlet.*;
^
src\com\example\web\BeerSelect.java:4: 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.*;
import java.io.*;

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: 235
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
Greenhorn

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

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: compiling problem with HF JSP book
 
Similar Threads
Problem in accessing model in diffeerent package(Servlet-HFS)
Package doesn't exists - error!!- How to resolve?
servlet compiling errors
Error in compliing Servlet
Classpath problem