text: vvus bharadwaj wrote:I have one directory called mypack.In side that i have some java files and i have a package called pack2.This pack2 contain some java files which belong to pack2 and other package called pack1.pack1 contains java files which belong to pack1.Now my Question is "How to compile the classes which require other classes in other package using classpath?"This is the example i am giving?
  1)
  package pack2;
  import pack1.*;
  public class B1 extends A21{}
  package pack1;
  public class A21{}
  For this I compile the B1 class successfully using javac B1.java(A21 successfully compiled)
  Why there is no need to use the classpath here?
  2)
  package pack2;
  //import pack1.*;
  public class B1 extends A21{}
  package pack2;
  public class A21{}
  If i tried to compile the B1 class(javac B1.java) i am getting the error .Why?To compile successfully this one command is javac -classpath ../. B1.java
  Please explain how compiler follows the classpaths.Explain me the rules when we compile the classes using the classpath i.e from where compiler starts looking for .class files and its progress till it finds?