title: How to run a single junit test from an ant project created by Netbeans from the command line?
body: <p>This answer works if you don't mind having extra collateral to remember/set the <code>CLASSPATH</code>: <a href="https://stackoverflow.com/questions/2235276/how-to-run-junit-test-cases-from-the-command-line">How to run JUnit test cases from the command line</a>.  But, if the project was created by Netbeans, the classpath is already in your project, and the project 'knows' how to run single unit tests and single unit test methods.</p>
  
  <pre><code>$ ant -p
  . . .
   test-single             Run single unit test.
   test-single-method      Run single unit test.
  . . .
  </code></pre>
  
  <p>However, if you try to build these targets, you will be presented with this error message (and then others) with no guidance on how to set the properties in question:</p>
  
  <pre><code>BUILD FAILED
  /home/me/myproject/nbproject/build-impl.xml:1300: Must select some files in the IDE or set javac.includes
  </code></pre>
  
  <p>Set the properties incorrectly, and ant will simply tell you that the build succeeded, but not compile nor run your test.  This is harder than it should be.</p>
  
  <p>So, how do we set the properties that these targets require?</p>