• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

compiling problem with HF JSP book

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 );
}

}

 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
now i feel like an idiot.

Thanks
 
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic