• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Chapter 10 Developement

Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a, probably novice, question about a piece of text in Chapter 10. I quote:

...let's look at another example:

import com.wickedlysmart.Utils;

class TestClass
void doStuff()
Utils myUtils = new Utils(); // simple name
myUtils.doX("arg1", "arg2");
com.wickedlysmart.Date d =
new com.wickedlysmart.Date(); // full name

In this case we're using two classes from the package com.wickedlysmart. For the sake of discussion we imported the fully qualified name for the Utils class, and we didn't for the Date class. The only difference is that because we listed Utils in an import statement, we didn't have to type its fully qualified name inside the class. In both cases the package is com.wickedlysmart. When it's time to compile or run TestClass, the classpath will have to include a directory with the following attributes:

A subdirectory named com (we'll call this the "package root" directory)
A subdirectory in com named wickedlysmart
Two files in wickedlysmart named Utils.class and Date.class

Now my question is, does the last written piece say:

"classpath will have to include a directory with any of the following attributes" ?


"classpath will have to include a directory with all the following attributes" ?

When I read it, it seems to me, if I am using a class MyClass in com/foo/bar, the classpath has to include com, and com/foo, and com/foo/bar, and com/foo/bar/MyClass.class. Then cannot be true now can it?
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I read it as meaning that the CLASSPATH contains the name of a directory which contains the directory com.

So if we had a directory /dev/src (the package root) and it contains the com directory, then the CLASSPATH would be of the form <other-dirs-or-jars>:/dev/src:<other-dirs-or-jars>

Taking a look at where the class files would be: we have two files Utils.class and Date.class in a directory /dev/src/com/wickedlysmart
[ May 18, 2007: Message edited by: Barry Gaunt ]
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic