我很新的Java編程和我想的jar添加到類路徑是這樣的:如何將我的jar添加到Java編譯路徑?
javac -classpath ~/Downloads/algs4.jar. ThreeSum.java
但我依然得到了異常,如:
ThreeSum.java:38: error: cannot find symbol
StdOut.println(a[i] + " " + a[j] + " " + a[k]);
^
symbol: variable StdOut
location: class ThreeSum
ThreeSum.java:62: error: cannot find symbol
int[] a = In.readInts(args[0]);
^
symbol: variable In
location: class ThreeSum
ThreeSum.java:64: error: cannot find symbol
Stopwatch timer = new Stopwatch();
^
symbol: class Stopwatch
location: class ThreeSum
ThreeSum.java:64: error: cannot find symbol
Stopwatch timer = new Stopwatch();
^
symbol: class Stopwatch
location: class ThreeSum
ThreeSum.java:66: error: cannot find symbol
StdOut.println("elapsed time = " + timer.elapsedTime());
^
symbol: variable StdOut
location: class ThreeSum
ThreeSum.java:67: error: cannot find symbol
StdOut.println(cnt);
^
symbol: variable StdOut
location: class ThreeSum
6 errors
我米here
爲什麼downvote ??? – sriram
「安裝教科書庫」一節(http://algs4.cs.princeton.edu/code/#classpath)解釋瞭如何做到這一點。 – Joe