0

Hi, All
I am new to servlets, i wrote one servlet file, it is compiling well.but if i try to run
this servlet. Its giving Error like: "Exception in thread "main" java.lang.NoSuchMethodError: main".
is their any problem with classpath, already i set servlet.jar file as a classpath.So let me know any thing requires.

package hall;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet {
  public void doGet(HttpServletRequest request,
                    HttpServletResponse response)
      throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    out.println("Hello World");
  }
}
2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by masijade
0

You run a servlet through an application server, not from the command line. Do you have an application server? Tomcat, WebSphere AS, Bea WebLogic, Sun AS, etc, etc.

Once you have one (you can download and use Tomcat for free), read its documentation to find out how you deploy an application, then deploy your servlet, and try to access it with the browser.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.