• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to solve this one  RSS feed

 
Karthikeyan Alagarsamy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am installed jdk 1.4.0 and j2ee 1.4 . i am compiled servlet file it gives error
my code is
----------
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class First extends HttpServlet{
public void doPost(HttpServletRequest request,HttpServletResponse
response) throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("hello");

}
}

after compilation

-------------
F:\Karthi\First.java:1: package javax.servlet does not exist
import javax.servlet.*;
^
F:\Karthi\First.java:2: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
F:\Karthi\First.java:5: cannot resolve symbol
symbol : class HttpServlet
location: class First
public class First extends HttpServlet{
^
F:\Karthi\First.java:6: cannot resolve symbol
symbol : class HttpServletRequest
location: class First
public void doPost(HttpServletRequest request,HttpServletResponse
^
F:\Karthi\First.java:6: cannot resolve symbol
symbol : class HttpServletResponse
location: class First
public void doPost(HttpServletRequest request,HttpServletResponse
^
F:\Karthi\First.java:7: cannot resolve symbol
symbol : class ServletException
location: class First
response) throws IOException, ServletException
^
6 errors

Process completed.
 
Praful Thakare
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add servlet.jar in your classpath

-P
 
nishadinesh gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

u need to set the path of where ur servlet prog is stored and also the classpath. i think u hd already set the path of folder. syntax for setting classpath is

F:\karthi>set classpath=%classpath%;c:\jsdk2.0\src.;

c:\jsdk2.0\src.; -- For this specify the drive where ur jsdk is stored.

Good Luck.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!