Setting paths for imports [message #532412] |
Sun, 09 May 2010 15:18  |
Eclipse User |
|
|
|
Forgive the newbie'ness of this question, please.
I'm working through the book Thinking in Java. As an addendum, the author provides a downloadable zip file of examples and importable classes.
I am on an example program which references one of these files. Specifically it has the line:
import static net.mindview.util.Print.*
The function it performs is quite simple, but my problem here is figureing out how to force Eclipse to know that the above net.mindview.util.Print.* is located on my hard drive.
I have worked through adding it under build path as an external class folder, but that did not work. Looking for help on how to associate import lines with files on the drive.
Thank you in advance. yes, I googled for help, yes this is a newbie question, yes you can yell at me, but that gets neither of us anywhere.
PittCaleb
|
|
|
Re: Setting paths for imports [message #532423 is a reply to message #532412] |
Sun, 09 May 2010 17:07  |
Eclipse User |
|
|
|
On 05/09/2010 02:18 PM, PittCaleb wrote:
> Forgive the newbie'ness of this question, please.
>
> I'm working through the book Thinking in Java. As an addendum, the
> author provides a downloadable zip file of examples and importable classes.
>
> I am on an example program which references one of these files.
> Specifically it has the line:
> import static net.mindview.util.Print.*
>
> The function it performs is quite simple, but my problem here is
> figureing out how to force Eclipse to know that the above
> net.mindview.util.Print.* is located on my hard drive.
>
> I have worked through adding it under build path as an external class
> folder, but that did not work. Looking for help on how to associate
> import lines with files on the drive.
Does the zip file contain compiled classes or source code. If it is
source code, you will have to compile it. The easiest way is to import
it into your workspace.
If it is as class files, are they provided as separate class files or
included as a jar. If in a jar, you have add the jar file to your build
path. If it is as separate class files, you will have to add the folder
to your build path. External class folder is one option. If not that
way, you will have to create a class folder in your project and import
the files into it.
Note that class folders need to be in hierarchical order. The
package/class you referenced above needs to be in a folder structure of
net/mindview/util/Print. You have to specify the folder that is the
root of net as the class folder location.
I would suggest you spend some time going through the tutorials in the
Java development user guide. There is a tutorial regarding Project
configuration. The guide is located in the Eclipse Help documentation.
>
> Thank you in advance. yes, I googled for help, yes this is a newbie
> question, yes you can yell at me, but that gets neither of us anywhere.
>
> PittCaleb
|
|
|
Powered by
FUDForum. Page generated in 0.02251 seconds