Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Basically, to compile your project with an externally provided library, you should add it to the classpath. There are multiple ways to do it based on what tools you are using. If you go the "rough" way using text editor and <code>javac</code> (recommended for beginners), you can do it like this:</p> <pre><code>javac -classpath .:/path/to/the/folder/containing/your/library MyClass.java </code></pre> <p>In your case if the folder <code>net</code> is in the folder <code>D:\libraries</code> your compilation command will look like this:</p> <pre><code>javac -classpath .:D:\libraries MyClass.java </code></pre> <p>Then in your source code you can just import the library the way the author does, i.e. just copy past his code:</p> <pre><code>import static net.mindview.util.Range.*; import static net.mindview.util.Print.*; public class MyClass { ..... } </code></pre> <p>If you use an IDE (for example NetBeans) you just add the library to the project. Just right-click on the <code>Libraries</code> in the <code>Projects Window</code> and choose <code>Add JAR/Folder</code>, then navigate to the folder containing the <code>net</code> library (folder <code>D:\libraries</code> in my previous example). Then the IDE will automatically add it to the classpath during the compilation.</p> <p>P.S. if you are a beginner in programming, I would recommend you avoiding Thinking in Java - it is meant for people wishing to broaden their knowledge at the post-beginner level. Start with something like <a href="http://rads.stackoverflow.com/amzn/click/0132575663" rel="nofollow">Java: How to Program by Deitel</a> - it is written for beginners and does not use author-developed libraries confusing you as a beginner and hiding important language details from you.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload