error: cannot find symbol. Running java class with packages through cmd
<p>I have a java application <code>Test</code>. Inside this I have two java files. <code>A.java</code>:</p>

<pre><code>import javax.servlet.GenericServlet;

public class A
{
    GenericServlet inter;
}
</code></pre>

<p>To compile this I used: </p>

<pre><code>javac -cp servlet-api.jar A.java
</code></pre>

<p>It compiled successfully.
Now another java file is <code>B.java</code>:</p>

<pre><code>import javax.servlet.GenericServlet;

public class B
{
    GenericServlet inter;
    A a = new A();
}
</code></pre>

<p>When I try to use:</p>

<pre><code>javac -cp servlet-api.jar B.java
</code></pre>

<p>I get the following error:</p>

<pre><code>error: cannot find symbol.
A a = new A();
^
Symbol: class A
location: class B
</code></pre>

<p>P.S: Please ignore the name of classes &amp; jar files involved as it is for demo purpose only.</p>