title: classpath specification
body: <p>i have two programs
  one in directory /home/redhat/Documents/java1/j1</p>
  
  <p>Demo1.java</p>
  
  <pre><code>package j1;
  public class Demo1
  {
          public void print()
          {
                  System.out.println("hi");
          }
  }
  </code></pre>
  
  <p>and the other in directory /home/redhat/Documents/java1/j</p>
  
  <p>Demo2.java</p>
  
  <pre><code>import j1.*;
  public class Demo2
  {
          Demo2()
          {
                  Demo1 d=new Demo1();
          }
  }
  </code></pre>
  
  <p>when i say</p>
  
  <pre><code>javac -classpath /home/redhat/Documents/java1/j1 Demo2.java
  </code></pre>
  
  <p>i get the following error</p>
  
  <pre><code>Demo2.java:2: package j1 does not exist
  import j1.*;
  ^
  Demo2.java:7: cannot access Demo1
  bad class file: /home/redhat/Documents/java1/j1/Demo1.java
  file does not contain class Demo1
  Please remove or make sure it appears in the correct subdirectory of the classpath.
                  Demo1 d=new Demo1();
                  ^
  2 errors
  </code></pre>
  
  <p>i want to access instance of Demo1 in Demo2 
  please help.</p>