Forums Register Login

compiling using -d flag

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
pallavi,

checkout the earlier thread "Command line arguements".

tobin
+Pie Number of slices to send: Send
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
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 709 times.
Similar Threads
cannot compile servlet from commandline
servlet compiling errors
Package doesn't exists - error!!- How to resolve?
Error in compliing Servlet
How To Compile Servlet
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 15:40:04.