Eclipse cannot resolve package name

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:

enter image description here

but Eclipse still cannot resolve the package name:

enter image description here

For me, everything seems OK and the package structure is correctly organised in folders:

enter image description here

Just in case, I also checked whether files correctly specify package name:

enter image description here

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.

Jon Skeet
people
quotationmark

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.

people

See more on this question at Stackoverflow