title: Java Class/Package interaction
body: <p>I have two .java files that I trying to compile with <code>javac</code> in OS X terminal.</p>
  
  <p>DieRun.java</p>
  
  <pre><code>package die;
  
  public class DieRun {
      public static void main(String[] args) {
  
          Die d6 = new Die(6);
  
      }
  }
  </code></pre>
  
  <p>And Die.java:</p>
  
  <pre><code>package die;
  
  import java.util.Random;
  
  public class Die {
  
      private int sides;
      private int value;
      private Random rng;
  
      public Die(int sides) {
          this.sides = sides;
          this.rng = new Random();
          this.value = this.roll();
      }
  
      public Die(int sides, int seed) {
          this.sides = sides;
          this.rng = new Random(seed);
          this.value = this.roll();
      }
  
      public int roll() {
          this.value = this.rng.nextInt(this.sides) + 1;
          return this.value;
      }
  
      public int getValue() {
          return this.value;
      }
  
  }
  </code></pre>
  
  <p>Using <code>javac *.java</code> they both compile without any errors but when I try to run one of them (eg. <code>java DieRun</code> ) it fails with error: Could not find or load main class DieRun.</p>