One: Build the Java environment:
Confirmed version: 1.8 and above
javac-versionJavac 1.8.0_111 |
java-versionjava Version "1.8.0_111" Java (tm) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot (tm) 64- Bit Server VM (build 25.111-b14, Mixed mode) |
Two
- Create directory /usr/local/algs4 .
[username:~/] cd/usr/local [username:/usr/local] sudo mkdir algs4 [Username:/usr/local]
sudo chmod 755 algs4 |
enters the subdirectory /usr/local/algs4 .
[username:/usr/local] cd ALGS4 [Username:/usr/loc AL/ALGS4] pwd /usr/local/algs4 |
- Downloads algs4.jar (includes javac-algs4 and JAVA-ALGS4).
[username:/usr/local/algs4] sudo wget http://algs4.cs.pri Nceton.edu/code/algs4.jar [USERNAME:/USR/LOCAL/ALGS4] sudo wget http://algs4.cs.princeton.edu/ LINUX/JAVAC-ALGS4 [USERNAME:/USR/LOCAL/ALGS4] sudo wget http://algs4.cs.princeton.edu/linux/ JAVA-ALGS4 [USERNAME:/USR/LOCAL/ALGS4] sudo chmod 755 javac-algs4 java-algs4 [username:/usr /LOCAL/ALGS4] sudo mv javac-algs4/usr/local/bin [USERNAME:/USR/LOCAL/ALGS4] sudo mv Java-algs4/usr/local/bin |
- Check if the installation is successful
JAVA-ALGS4 Edu.princeton.cs.algs4.StdDraw JAVA-ALGS4 Edu.princeton.cs.algs4.StdAudio [Plays A Major scale] |
Reference:
http://algs4.cs.princeton.edu/linux/
The fourth version of the algorithm calls the ALGS4 library in Linux