• 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 using -d flag

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Created BeerSelect.java in
D:\myprojects\beer1\src\com\example\web

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("<html><body><h1 align=center>BEEER</h1>"
+"</body></html>");
}
}
now for compiling the Servlet using �d
cd myprojects/beer1

javac � classpath d:\tomcat4.1/commom/lib/Servlet-api.jar:classes:. �d classes src/com/example/web/BeerSelect.java

getting error that cant resolve HttpServlet, HttpServletRequest, HttpServletResponse and ServletException

am sure path to servlet.jar is set correctly as it compiles when �d is not used�.moreover I didn�t find servlet-api.jar file in lib�..is that causing the problem
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
pallavi,

checkout the earlier thread "Command line arguements".

tobin
 
pallavi utukuri
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks my error got resolved by using...

Compiling BeerSelect.java
Cd myprojects
Cd beer1

javac -classpath /tomcat4.1/common/lib/servlet-api.jar:classes:.; C:\j2sdk1.4.2_05\lib\j2ee.jar; -d classes src/com/example/web/BeerSelect.java


Compiling BeerExpert.java
Cd my projects
Cd beer1

javac -classpath /tomcat4.1/common/lib/servlet-api.jar:classes:.; C:\j2sdk1.4.2_05\lib\j2ee.jar; d:\MyProjects\beerV1\classes -d classes src/com/example/web/BeerSelect.java
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic