Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Setting paths for imports
Setting paths for imports [message #532412] Sun, 09 May 2010 15:18 Go to next message
PittCaleb  is currently offline PittCaleb
Messages: 1
Registered: May 2010
Junior Member
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 Go to previous message
David Wegener is currently offline David Wegener
Messages: 1336
Registered: July 2009
Senior Member
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
Previous Topic:Platform fails installing JDT
Next Topic:compiler finding plugin jar instead of library jar
Goto Forum:
  


Current Time: Wed Aug 20 06:49:50 EDT 2014

Powered by FUDForum. Page generated in 0.01799 seconds