• 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

Need Help in compiling servlet from Command Prompt

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,

I am using Oreilly Head First Servlet book and having trouble in compiling servlets from cmd.
Tomcat path is : C:\Program Files\Apache Software Foundation\Tomcat 6.0

Below is compiling result

C:\Projects\beerV1>javac -classpath "%TOMCAT_HOME%\lib\servlet-api.jar:"classes:
. -d classes src/com/example/web/BeerSelect.java
src\com\example\web\BeerSelect.java:3: error: package com.example.model does not
exist
import com.example.model.*;
^
src\com\example\web\BeerSelect.java:4: error: package javax.servlet does not exi
st
import javax.servlet.*;
^
src\com\example\web\BeerSelect.java:5: error: package javax.servlet.http does no
t exist
import javax.servlet.http.*;
^
src\com\example\web\BeerSelect.java:6: error: package javax.io does not exist
import javax.io.*;
^
src\com\example\web\BeerSelect.java:7: error: package javax.util does not exist
import javax.util.*;
^
src\com\example\web\BeerSelect.java:9: error: cannot find symbol
public class BeerSelect extends HttpServlet{
^
symbol: class HttpServlet
src\com\example\web\BeerSelect.java:10: error: cannot find symbol
public void doPost(HttpServletRequest request, HttpServletResponse respo
nse) throws IOException,ServletException{
^
symbol: class HttpServletRequest
location: class BeerSelect
src\com\example\web\BeerSelect.java:10: error: cannot find symbol
public void doPost(HttpServletRequest request, HttpServletResponse respo
nse) throws IOException,ServletException{
^
symbol: class HttpServletResponse
location: class BeerSelect
src\com\example\web\BeerSelect.java:10: error: cannot find symbol
public void doPost(HttpServletRequest request, HttpServletResponse respo
nse) throws IOException,ServletException{

^
symbol: class IOException
location: class BeerSelect
src\com\example\web\BeerSelect.java:10: error: cannot find symbol
public void doPost(HttpServletRequest request, HttpServletResponse respo
nse) throws IOException,ServletException{

^
symbol: class ServletException
location: class BeerSelect
src\com\example\web\BeerSelect.java:13: error: cannot find symbol
BeerExpert be = new BeerExpert();
^
symbol: class BeerExpert
location: class BeerSelect
src\com\example\web\BeerSelect.java:13: error: cannot find symbol
BeerExpert be = new BeerExpert();
^
symbol: class BeerExpert
location: class BeerSelect
src\com\example\web\BeerSelect.java:14: error: cannot find symbol
List result = be.getBrands(c);
^
symbol: class List
location: class BeerSelect
src\com\example\web\BeerSelect.java:17: error: cannot find symbol
RequestDispatcher view = request.getDispatcher("result.jsp");
^
symbol: class RequestDispatcher
location: class BeerSelect
14 errors

C:\Projects\beerV1>
 
Marshal
Posts: 16594
277
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A couple I can see:
1. As far as I know, Windows uses semicolon as a path separator; Unix/Linux uses the colon.
2. You should run your javac command from the src directory. That is, you should cd src first before running your javac command.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic