I have a java application Test
. Inside this I have two java files. A.java
:
import javax.servlet.GenericServlet;
public class A
{
GenericServlet inter;
}
To compile this I used:
javac -cp servlet-api.jar A.java
It compiled successfully.
Now another java file is B.java
:
import javax.servlet.GenericServlet;
public class B
{
GenericServlet inter;
A a = new A();
}
When I try to use:
javac -cp servlet-api.jar B.java
I get the following error:
error: cannot find symbol.
A a = new A();
^
Symbol: class A
location: class B
P.S: Please ignore the name of classes & jar files involved as it is for demo purpose only.