Re: Help needed with importing
Clarence wrote:
Thank you all for your responses. The tutorial I was referring to is
at http://download.oracle.com/javase/tutorial/java/index.html
I found the part I was missing in the "Managing Source and Class
files" section. I see that either
Glad you found that link helpful.
1) my original setup (with no package declarations and CountyAgi and
CensusData in the same directory I was compiling from) would have
worked had I but included "." in the classpath
It is not recommended to use the so-called "default package" (no package) for
real code, though it's harmless enough in quick-and-dirty experiments.
2) having put CensusData in a named package, I then had to also put
it in a subdirectory of that same name.
When I first learned Java in the '90s I found the link between packages and
directories very tricky to grok. To this day I still have to re-read the
directions and experiment to be certain I have the syntax right for the
"javac" command.
Tom is correct that this is a Hadooop program, and Joshua is correct,
for a different reason, that there are more items in the classpath
than are needed, because it would appear that some Hadoop libraries
have been consolidated since the docs were written.
Now that you're on the road to mastering packages you are well on your way to
mastering Java.
For further education there are at least two books you should own and a number
of online resources that will assist:
Books:
/Effective Java/ by Joshua Bloch.
http://java.sun.com/docs/books/effective/
/Java Concurrency in Practice/ by Brian Goetz, et al.
http://www.javaconcurrencyinpractice.com/
Anything by Doug Lea or the above two.
Online resources:
https://www.ibm.com/developerworks/java/
Brian Goetz is a regular contributor to Developerworks.
http://mindprod.com/jgloss/jgloss.html
Roedy Green has put together a compendium of useful Java-related information.
Much of it is specifically geared to the newcomer.
and more.
--
Lew