title: Cant see static methods in compiled classes in same package
body: <p>I want to define a class with static flags for debug modes that objects throughout my program can see and output debug information accordingly. The "Option" class has no dependencies and I compile it first. (all from commandline / .bat file) The Option class compiles, but classes which reference it won't compile with a "cannot find symbol" error.</p>
  
  <pre><code>//Options - holds options for code, including debug modes, getters, setters
  package UserViewer;
  
  public class Option {
  
      private static boolean debug1 = false;
      private static boolean debug2 = false;
      private static boolean debug3 = false;
      private static boolean debug4 = false;
  
      public static boolean isDebug1() {
          return debug1;
      }
      public static void setDebug1(boolean val) {
          debug1 = val;
      }
      public static boolean isDebug2() {
          return debug2;
      }
      public static void setDebug2(boolean val) {
          debug2 = val;
      }
      public static boolean isDebug3() {
          return debug3;
      }
      public static void setDebug3(boolean val) {
          debug3 = val;
      }
      public static boolean isDebug4() {
          return debug4;
      }
      public static void setDebug4(boolean val) {
          debug4 = val;
      }
  }
  </code></pre>
  
  <p>Here is the first class I attempt to compile that references the static methods in Option</p>
  
  <pre><code>//contains all the User Interface elements
  package UserViewer;
  
  import javafx.scene.layout.BorderPane;
  import javafx.event.ActionEvent;
  import javafx.event.EventHandler;
  import javafx.event.ActionEvent;
  
  class UIPane extends BorderPane implements EventHandler&lt;ActionEvent&gt; {
  
      UIPane() {
          if(Option.isDebug1() == true) { System.out.println("UIPane succesfully loaded."); }
      }
  
      @Override
      public void handle(ActionEvent e) {
          if(Option.isDebug2() == true) { System.out.println("Action Event detected in UIPane."); }
      }
  }
  </code></pre>
  
  <p>Here is compile.bat</p>
  
  <pre><code>javac -d . CONST.java
  javac -d . Option.java
  javac -d . UIPane.java
  javac -d . App.java
  javac -d . UserViewer.java
  java UserViewer.UserViewer DEBUG1
  pause
  </code></pre>
  
  <p>Since they are all in the same package - UserViewer - I thought I could reference these static methods from anywhere in the program. </p>
  
  <p>Here's the (first) compiler error:</p>
  
  <pre><code>C:\...\UserViewer&gt;javac -d . UIPane.java
  UIPane.java:12: error: cannot find symbol
      if(Option.isDebug1() == true) { System.out.println("UIPane succesfully loaded."); }
   symbol:   variable Option
   location: class UIPane
  UIPane.java:17: error: cannot find symbol
      if(Option.isDebug2() == true) { System.out.println("Action Event detected in UIPane."); }
   symbol: variable Option
   location: class UIPane
  </code></pre>
  
  <p>I have the same problem with CONST.java and with all other objects that depend on CONST and Option, but I have omitted the other errors since they all seem to be the same problem - the rest of my code cannot see Option.class or CONST.class, though they are in the same package. Option.class and CONST.class do compile and are in the correct package subdirectory UserViewer.</p>
  
  <p>Any help is appreciated.</p>
  
  <p><strong>EDIT: Solution in the comments</strong></p>
  
  <p>I needed to either compile all the classes simultaneously or declare classpaths for dependent classes.</p>
  
  <p>My new .bat file looks like this:</p>
  
  <pre><code>javac -d . *.java
  java -cp ./UserViewer;. UserViewer.UserViewer DEBUG1
  </code></pre>