This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes need help, compiler error problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "need help, compiler error problem" Watch "need help, compiler error problem" New topic
Author

need help, compiler error problem

eric lee
Ranch Hand

Joined: Nov 04, 2002
Posts: 86
i set up .bat file(set classpath=C:\Apache Tomcat 4.0\common\lib\servlet.jar but it is still not work.if i want compile two file which relate together,how to compile or set up environment?
it always said can not resolve symbol "Hello"
Thanks.
import javax.servlet.* ;
import javax.servlet.http.*;
import java.io.*;
public class PrintHello extends HttpServlet {
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
Hello h=new Hello();
out.print(h.print());
out.close();
}
}
------------------------------------------------
public class Hello
{
public String print()
{
return "Hello Servlet";
}
}
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
does your classpath also contain the directory that you are compiling in? It should either have that directory's full path name, or just "." meaning "the current directory".


Ron Newman - SCJP 1.2 (100%, 7 August 2002)
 
wood burning stoves
 
subject: need help, compiler error problem
 
Similar Threads
Log4j RollingFileAppender doesn't write to file in Websphere
Need Help
Cannot compile servlet
Problem with Package execution
Package Compilation Problem