Help needed on Exception in thread "main" java.lang.NoSuchMethodError: main

I have got this message after trying to compile the java servlet file

HelloWorldExample.java. May I know what is the reason and how to

resolve it. Thanks! Below is the code.

import java.io.*;

import java.text.*;

import java.util.*;

import javax.servlet.*;

import javax.servlet.http.*;

public class HelloWorldExample extends HttpServlet {

public void doGet(HttpServletRequest request,

HttpServletResponse response)

throws IOException, ServletException

{

ResourceBundle rb =

ResourceBundle.getBundle("LocalStrings",request.getLocale());

response.setContentType("text/html");

PrintWriter out = response.getWriter();

out.println("<html>");

out.println("<head>");

String title = rb.getString("helloworld.title");

out.println("<title>" + title + "</title>");

out.println("</head>");

out.println("<body bgcolor=\"white\">");

out.println("<a href=\"../helloworld.html\">");

out.println("<img src=\"../images/code.gif\" height=24 " +

"width=24 align=right border=0 alt=\"view code\"></a>");

out.println("<a href=\"../index.html\">");

out.println("<img src=\"../images/return.gif\" height=24 " +

"width=24 align=right border=0 alt=\"return\"></a>");

out.println("<h1>" + title + "</h1>");

out.println("</body>");

out.println("</html>");

}

}

[1534 byte] By [noobboya] at [2007-11-27 4:30:51]
# 1
You mean you got this error when you tried to run it? You can't run servlet code as you a regular java application. You need an application server to host it. http://tomcat.apache.org/
kdajania at 2007-7-12 9:40:13 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...