title: javac junit gives "error: package org.junit does not exist"
body: <p>I'm trying to use JUnit in a makefile but I can't get it to work. </p>
  
  <p>My folder structure is as follows (makefile is in myProject):</p>
  
  <pre><code>myProject
  |--bin
  |--main
      |--org
          |--myPackage
  |--test
      |--org
      |   |--myPackage
      |
      |--lib
  </code></pre>
  
  <p>where /main contains main files, /test contains test files and /lib contains <code>hamcrest-core-1.3.jar</code> and <code>junit-4.12.jar</code></p>
  
  <p>My makefile is as follows:</p>
  
  <pre><code>JAVAC = javac
  JVM = java
  JAVADOC = javadoc
  MKBIN = mkdir -p bin
  
  JAVAC_FLAGS = -g -d bin/
  JAVAC_CP = -cp
  
  SRC = main/
  SRCTEST = test/
  LIB = lib/*.jar
  
  PACKAGE = org/myPackage/*.java
  TARGET = bin
  
  MAIN = org.myPackage.Main
  
  .SUFFIXES : .class .java
  
  all: 
      $(MKBIN) | $(JAVAC) $(JAVAC_FLAGS) $(SRC)$(PACKAGE)
  
  test:
      $(MKBIN) | $(JAVAC) $(JAVAC_CP) $(LIB) $(SRCTEST)$(PACKAGE)
  
  clean:
      rm -rf $(TARGET)
  
  run:
      $(JVM) $(JAVAC_CP) $(TARGET) $(MAIN)
  
  .PHONY: all test clean
  </code></pre>
  
  <p>When I'm running <code>make test</code> I get the following:</p>
  
  <pre><code>~/myProject | 18:07:29&gt;make test
  mkdir -p bin | javac -cp lib/*.jar test/org/myPackage/*.java
  test/org/myPackage/MyClass.java:3: error: package org.junit does not exist
  import static org.junit.Assert.*;
  
  ...
  </code></pre>
  
  <p>In Eclipse the tests work perfectly fine. What am I doing wrong?</p>