1, path path Add:
Environment variable opening method:我的电脑—>(右键)属性—>高级系统设置—>环境变量
1.1, jdk the path path to add, verify jdk path is added successfully enter cmd in need java on the line, back a long list of characters appearing on the success it represents an input.
Path 2.2, algs_4.jar added packet,To be the new environment variable CLASSPATHThen algs4_jar the absolute path added to it just fine.
Note: The download package algs4.jar
2, idea entry and add the .jar and jdk
2.1, idea to create a new project: file-> new-> project (the rest is their own definition of the project name and the absolute path of the project is located)
2.2, then add the source code is the same as a similar vs, attentionJava class name must be consistent with the source file nameOtherwise, the compiler does not pass. We
src
add a Java class in which:
2.3, jar package is introduced into the jdk added: file-> Project Structure
2.4, this should be the most pit the point where the algorithm 4th edition of algorithm testing is
通过文件数据
to test, for exampletinyW.txt < tinyT.txt
.
In the run-> edit configurations to set an invalid command-line arguments, and does not automatically output data (do not know the specific reasons for the relative and absolute paths are used, but still can not automatically output data):
Switch to manually compile .java in the Terminal will be able to automatically output the data (no wonder the book has been manually enter the command-line arguments, so we can only manually compile the .java ??)
Note: cd + absolute path to the directory, javac command is used to compile .java, java command to run the .java (this step is not required suffix, with the class name on the line). Here I use the java command directly compile and run the .java, save a little.