"Algorithm" first into the pit-configuration Algs4.rar

Source: Internet
Author: User

Do not understand, obviously foreign textbooks can be written very easy, such as Take me to get Started "Head first Java" and this

"Algorithm" (4th edition), but not in the environment configuration there is clearly written, like "stupid method Python" in the face of

Close PowerShell configuration Python environment variables and some common directives it's very friendly, and there's another one that wants to teach Java

"Java language Program design" in the face of Eclipse how to create a new project and class introduction, is really considering what is not

Understand the beginner's feelings.

After the pits, we begin to talk about the Algs4.jar that the author prepared for us in eclipse, speaking of this article

Pieces, in fact, is a zip-like compressed file, do not believe the right-click decompression, there will be a lot more stuff out. Yes, some online

Older answers may say that you want to download Stdlib.jar or something, but the author has made it very clear at first, and the previous Stdlib.jar

has been included in the Algs4.jar.

Download algs4.jar:http://algs4.cs.princeton.edu/code/on this book website

Solution Reference: http://blog.csdn.net/jierui001/article/details/3357464

  

First, configure Eclipse

1. In the following project (Project), select Properties

2. Select libraries (library)-add External JARs (Import external library) in Java Build path and select

The path of your algs4.rar is on the line. Like mine, it's on the C:\\users\username\algs4\algs4.jar.

"Username is your hostname/user name"

OK, it's quite easy to get here. Eclipse is still relatively friendly.

Second, configure the command line

The truth is far less complicated than we thought. Let's say that the Drawpanel.java file we're compiling is located in E:\Java\demo\demo\

First, if you are in the order of normal compilation and execution, that is, in the path where the file is located:

Javac package name \ source file name (e.g. Javac Demo\drawpanel.java)

Java package name. Class name, such as Java demo. Drawpanel)

Well, unfortunately, you will appear and I the same mistake, this problem, I Baidu for a long time, q^q think really tragic ah, every time died in the installation

The time of the thing.

So when this problem arises, how to solve it, in fact, or accidentally in the watercress here to see the answer, but the author gave the answer, too unclear

It's obvious. At least for me, this super little white.

Or go to the directory where the Java files are located

"My drawpanel.java is placed in the E:\Java\demo\demo\ directory."

   E:

CD Java\demo

And then it's compiled with JAVAC-CP instead of Javac.

          JAVAC-CP C:\Users\hasee\algs4\algs4.jar Demo\drawpanel.java

JAVA-CP C:\Users\hasee\algs4\algs4.jar; demo. Drawpanel

The full path of the Algs4.jar file must be entered here, it should be emphasized that in the second command, thejar file must be followed by a semicolon and a space , otherwise

There will also be errors that cannot be found or cannot be loaded for the main class. Microsoft is really a lot of TM.

The above error will also occur if the path is only input Algs4.jar and is separated from the semicolon.

If this is the case, the path is incomplete, but with the semicolon separated. It's not the same wrong way.

"Algorithm" first into the pit-configuration Algs4.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.