Jigar Rathod wrote:tes/xcom folder is having 3 things :
A.java ; A.class ; B.java
------A.java
package xcom;
public class A{}
-------B.java
paclage xcom;
public class B extends A{}
now this thing works if you are in test folder
javac -classpath . xcom/B.java
i modified a bit
javac -classpath xcom/A.class xcom/B.java
this doesn't work
why???
Because the classpath should point to the place where A.class is located. In the above example
javac -cp . xcom/B.java should be invoked from tes directory and .(dot) here specifies to look up for any needed classes in the current directory. A.class is not located at xcom/A.class but is located in tes/xcom.
You have to specify the classpath for the class and not the class itself.