Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compiling using -d flag

 
pallavi utukuri
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • 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
 
Tobin Jackson
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic