This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes servlet compiling problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet compiling problem." Watch "servlet compiling problem." New topic
Author

servlet compiling problem.

Balu Ramachandran
Greenhorn

Joined: Oct 16, 2000
Posts: 16
hi friends,
can any body please help me!
while i try to compile servlet code i got following error.
i think it may be a classpath problem. please help me.
my source code:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ServDemo extends HttpServlet
{
public void doPost(HttpServletRequest req,HttpServletRsponse resp)
throws ServletException,IOException
{
resp.setContentType("text/html");
PrintWriter out=new PrintWriter(resp.getOutputStream());
out.println("<html><body><h1>this is demo java servlet programming<h1></body></html>");
out.flush();
out.close();
}
}

OUTPUT ERROR:
D:\jdk1.3\bin\javac.exe -d G:\demo -deprecation ServDemo.java
Class Path - G:\demo\;C:\PROGRAM FILES\JAVASOFT\JAXP1.0.1\JAXP.JAR;C:\PROGRAM;FILES\JAVASOFT\JAXP1.0.1\PARSER.JAR;D:\JAXP\JAXP.JAR;D:\JAXP\PARSER.JAR;D:\JWS\LIB\SERVLET.JAR;.;D:\kawa322\kawaclasses.zip;d:\jdk1.3\l ib\tools.jar;d:\jdk1.3\jre\lib\rt.jar
File Compiled...
--------------------------- Compiler Output ---------------------------
ServDemo.java:2: package javax.servlet does not exist
import javax.servlet.*;
^
ServDemo.java:3: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
ServDemo.java:5: cannot resolve symbol
symbol : class HttpServlet
location: class ServDemo
public class ServDemo extends HttpServlet
^
ServDemo.java:7: cannot resolve symbol
symbol : class HttpServletRequest
location: class ServDemo
public void doPost(HttpServletRequest req,HttpServletRsponse resp)
^
ServDemo.java:7: cannot resolve symbol
symbol : class HttpServletRsponse
location: class ServDemo
public void doPost(HttpServletRequest req,HttpServletRsponse resp)
^
ServDemo.java:8: cannot resolve symbol
symbol : class ServletException
location: class ServDemo
throws ServletException,IOException
^
6 errors

-----------------------------------------------------------------------------
thanks,
with regards,
Balu Ramachandran.


R.Balu
Prasad Charasala
Ranch Hand

Joined: Nov 02, 2000
Posts: 67
Hi,
It is clear from the error you are getting that javax.*.* package is not in the classpath.
Put the package in the classpath if you have that or download it from the http://java.sun.com


------------------
Prasad


<B>Prasad</B>
Balu Ramachandran
Greenhorn

Joined: Oct 16, 2000
Posts: 16
thanks friend,
my doubt is clear.
i made mistake in class path setting.
set classpath=c:\jsdk2.0\src

now its working fine.
thanks,
regards,
Balu Ramachandran
Bangalore.india
 
Consider Paul's rocket mass heater.
 
subject: servlet compiling problem.
 
Similar Threads
servlet class not compiling. Classpath problem?
Javac cannot find servlet package
How To Compile Servlet
not able to run simple servlet
Newbie with servlets and JBoss