• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need Help in compiling servlet from Command Prompt  RSS feed

 
Raja gopal Mani
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • 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>
 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!