Login  Register

Re: Path Problem?

Posted by dscho on Jan 20, 2010; 12:01am
URL: http://imagej.273.s1.nabble.com/Path-problem-tp3689668p3689674.html

Hi,

On Tue, 19 Jan 2010, Bob wrote:

> Thank you!  It all works now, when I put the path in the .config file.  
> That was the missing piece.  Yes, it was a conspiracy--ImageJ forcing
> things into packages before allowing objects to call one another, and
> then Java having this subtle issue with paths inside .jar files needing
> to match the package structure.

This cannot stand as you put it.

It was a concious design decision of Java to require classes to be put
into packages before they can be imported.  If you have a class that is in
the default package (i.e. none), you can use other classes from that
default package, but that is bad style anyway, as there would be too many
clashes if everybody did that.

And the alternative to letting classes be put into .jar files wherever you
like it instead of according to the package would mean an unbearable
performance impact.  Basically, _every_ _single_ class in _every_ _single_
.jar file would have to be inspected if it might be the one you might look
for (remember, you can say "import ij.*;")!

So I think that both issues you hit have a very good reason for having to
be fixed on your side instead of anywhere else.

Ciao,
Dscho

P.S.: I would be interested to know if there is any Java book out there
which fails to mention both that you should put classes into appropriate
packages (and why) and that you must put classes into directory structures
reflecting the package structure (does not matter whether they are inside
a .jar file or in a directory in the classpath).