problem in calling classes in simple Servlet
Hello Jomet,
I am facing the same problem. And also tried both ways but i am not successfull. I don't know why??
I have one servlet (Register.java)
and a java class(Function.java)
First I compiled Function.java successfully but
When i compiling Register.java its giving me error Function class not found
In both way :-
1. javac -cp . *.java or javac -classpath . *.java
2. copying the class path where my from my tomcat path like:-
C:\Program Files (x86)\Apache Software Foundation\Apache Tomcat 7.0.22\webapps\loginnapp\WEB-INF\classes
but in both cases i am getting a common error:-
import javax.servlet.*;
^
Register.java:4: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
Register.java:5: package javax.servlet does not exist
import javax.servlet.*;
^
Register.java:8: cannot find symbol
symbol: class HttpServlet
public class Register extends HttpServlet
^
Register.java:10: cannot find symbol
symbol : class HttpServletRequest
location: class Register
public void doGet(HttpServletRequest req, HttpServletResponse res) throw
s IOException, ServletException
^
Register.java:10: cannot find symbol
symbol : class HttpServletResponse
location: class Register
public void doGet(HttpServletRequest req, HttpServletResponse res) throw
s IOException, ServletException
^
Register.java:10: cannot find symbol
symbol : class ServletException
location: class Register
public void doGet(HttpServletRequest req, HttpServletResponse res) throw
s IOException, ServletException
^
Register.java:28: cannot access Functions
bad class file: .\Functions.class
class file contains wrong class: classes.Functions
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
Functions fe=new Functions();
^
8 errors
please help me friends i m stuck
|