title: Java import does not exist package
body: <p>I have this folder structure:</p>
  
  <pre><code>MyProject 
      src/
        com/example/
          model/
          web/
      classes/ 
  </code></pre>
  
  <p><code>src</code> for source code, <code>classes</code> for classes.</p>
  
  <p>I was trying to compile a java file from web folder, and to do that I had to import one class from the model folder. I did that,but the compiler was saying:</p>
  
  <blockquote>
    <p>"package com.example.model.*; doesn't exist".</p>
  </blockquote>
  
  <p>Eventually I managed to compile it with this command: </p>
  
  <p><code>C:\Users\dimit\Desktop\MyProject\beerV1&gt;javac -classpath C:\Users\dimit\Desktop\apache-tomcat-9.0.5\lib\servlet-api.jar;C:\Users\dimit\Desktop\MyProject\beerV1\classes -d classes src/com/example/web/BeerSelect.java</code></p>
  
  <p>But it looks kind of a bad. Is there any way to compile the java without adding classpath? I mean both web and model source codes are in the same package, why there is a problem in finding the <code>com.example.model.*;</code> package?</p>
  
  <p>Here is the code </p>
  
  <pre><code>package com.example.model;
  import java.util.*;
  
  public class BeerExpert {
  
      public List getBrands(String color) {
          List&lt;String&gt; brands=new ArrayList&lt;String&gt;();
          if(color.equals("amber")) {
              brands.add("Jack Amber");
              brands.add("Red Moose");
          }else{
              brands.add("Jail Pale Ale");
              brands.add("Gout Stout");
          }
          return (brands);
      }
  }
  </code></pre>