I have started to learn Java along with Eclipse and the book "Thinking in Java" by Bruce Eckel. I tried to add his util
package (from net.mindview.util
) to a project but Eclipse complains the name cannot be resolved.
I added an external folder net
. It contains other folders atunit
, simple
and util
which containts uncompiled *.java
files. In Java Build Path -> Libraries, I have pointed at the external class folder:
but Eclipse still cannot resolve the package name:
For me, everything seems OK and the package structure is correctly organised in folders:
Just in case, I also checked whether files correctly specify package name:
I run out of options. The Eclipse help just shows how to add external folders and does not say what to do if there are problems.
Hopefully someone can help with that. Thanks.
You've got one directory too far when adding the library to the build path. The library should be showing up as TIJ4Code
, in the Java
directory. (Or in other words, when you choose "Add class folder" you should be choosing TIJ4Code
, not net
.)
That way net
becomes the first part of the package name - whereas Eclipse is currently treating net
as the "root" directory of the library, so it thinks that Print
"should" be in a package of mindview.util
for example.
See more on this question at Stackoverflow