I've been trying to learn Java on my own and using http://algs4.cs.princeton.edu/code/ as my resource.
Unfortunately, I haven't been able to figure out how to set drjava so that it can properly reference algs4.jar.
So when I tried to compile the following 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);
}
}
it doesnt compile.
I know that it's not referencing the jar file because if i just download StdDraw.java
in the folder my java script is in, it compiles just fine.
The website above says the following:
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.
I did add algs4.jar to the Drjava classpath by clicking on edit->preferences->resource locations -> extra classpath -> then clicking on the algs4.jar file
.
(I'm trying to do this on both windows and ubuntu. I have been having the same issue on both.)
I have done echo $PATH on ubuntu to make sure that the path is indeed set to the folder that contains algs4.jar
.
I have checked Environmental Variables -> PATH
and confirmed that it was set to the folder that contains algs4.jar
.
This must be quite trivial, so I apologize in advance