Be sure to set your classpath environment variable.  It should include “.” and all other directories you wish the compiler to search in for byte code files.  After setting the classpath from the command line type “echo %classpath%” to be sure it was set.

 

Ways to have access to another class.

 

 

Examples:

 

package edu.harding.oop.steil;

//import edu.harding.oop.steil.B;

//import edu.harding.oop.steil.*;

 

public class A

{

     public static void main(String args[])

     {

          B b = new B();

     }

}

 

 

//compile this file with the -d directive to save the

//class file in c:\some_directory\edu\harding\oop\steil

 

package edu.harding.oop.steil;

 

public class B

{

     public static void main(String args[])

     {

     }

}