title: how to reference a jar library in Java
body: <p>I've been trying to learn Java on my own and using <a href="http://algs4.cs.princeton.edu/code/" rel="nofollow">http://algs4.cs.princeton.edu/code/</a> as my resource.</p>
  
  <p>Unfortunately, I haven't been able to figure out how to set drjava so that it can properly reference algs4.jar.</p>
  
  <p>So when I tried to compile the following code,</p>
  
  <pre><code>public class TestStdDraw1 {
         public static void main(String[] args) {
             StdDraw.setPenRadius(0.05);
             StdDraw.setPenColor(StdDraw.BLUE);
             StdDraw.point(0.5, 0.5);
             StdDraw.setPenColor(StdDraw.MAGENTA);
             StdDraw.line(0.2, 0.2, 0.8, 0.2);
         }
     }
  </code></pre>
  
  <p>it doesnt compile.</p>
  
  <p>I know that it's not referencing the jar file because if i just download <code>StdDraw.java</code> in the folder my java script is in, it compiles just fine.</p>
  
  <p>The website above says the following:</p>
  
  <p>Mac OS X (automatic). The Mac OS X installer downloads algs4.jar to the /Users/username/algs4 folder; adds it to the DrJava classpath; and provides the wrapper scripts javac-algs4 and java-algs4, which classpath in algs4.jar, for use in the Terminal.</p>
  
  <p>I did add algs4.jar to the Drjava classpath by clicking on <code>edit-&gt;preferences-&gt;resource locations -&gt; extra classpath -&gt; then clicking on the algs4.jar file</code>.</p>
  
  <p>(I'm trying to do this on both windows and ubuntu.  I have been having the same issue on both.)  </p>
  
  <p>I have done echo $PATH on ubuntu to make sure that the path is indeed set to the folder that contains <code>algs4.jar</code>.  </p>
  
  <p>I have checked <code>Environmental Variables -&gt; PATH</code> and confirmed that it was set to the folder that contains  <code>algs4.jar</code>.  </p>
  
  <p>This must be quite trivial, so I apologize in advance</p>