From: Sam Takoy on
Hi,

Can splitting packages among different jars ever cause a problem?

And, in this regard, could there be a difference between plain java and
more elaborate environments, such as tomcat (with custom loaders, etc.)

Many thanks in advance,

Sam
From: Andreas Leitgeb on
Sam Takoy <sam.takoy(a)yahoo.com> wrote:
> Can splitting packages among different jars ever cause a problem?

It can and will, iff you deal with "sealed" packages.

See: http://mindprod.com/jgloss/jar.html#SEALING
and: http://java.sun.com/docs/books/tutorial/deployment/jar/sealman.html

> And, in this regard, could there be a difference between plain java and
> more elaborate environments, such as tomcat (with custom loaders, etc.)

If the custom classloaders decide to "seal" the packages they load,
then it's the same as above. (regardless of any jar-file manifests)
I wouldn't really expect that to happen, though.

Other than that all, I think it should be fine.
From: Lew on
Sam Takoy wrote:
>> Can splitting packages among different jars ever cause a problem?

Andreas Leitgeb wrote:
> It can and will, iff you deal with "sealed" packages.
> ...
> http://java.sun.com/docs/books/tutorial/deployment/jar/sealman.html

Sam Takoy wrote:
>> And, in this regard, could there be a difference between plain java [sic] and
>> more elaborate environments, such as tomcat [sic] (with custom loaders, etc.)

Andreas Leitgeb wrote:
> If the custom classloaders decide to "seal" the packages they load,
> then it's the same as above. (regardless of any jar-file manifests)
> I wouldn't really expect that to happen, though.
>
> Other than that all, I think it should be fine.

It could potentially make life harder to make sure all JARs are present where
needed, but other than that it's actually quite standard, for example to
segregate test classes from production classes.

--
Lew
From: Arne Vajhøj on
On 18-06-2010 02:50, Sam Takoy wrote:
> Can splitting packages among different jars ever cause a problem?
>
> And, in this regard, could there be a difference between plain java and
> more elaborate environments, such as tomcat (with custom loaders, etc.)

Normally it should not cause a problem.

But I guess it could happen. If the jar files are used
by different classloaders, then there could be a problem.

In general I would say that if classes are so coupled that
they deserve to be in the same package then they are also
so coupled that they should be in the same jar file.

Arne

From: Roedy Green on
On Fri, 18 Jun 2010 02:50:38 -0400, Sam Takoy <sam.takoy(a)yahoo.com>
wrote, quoted or indirectly quoted someone who said :

>Can splitting packages among different jars ever cause a problem?

Why are you doing this? Are you trying to put rarely used classes
into a lazily loaded jar?
--
Roedy Green Canadian Mind Products
http://mindprod.com

There is no harm in being sometimes wrong especially if one is promptly found out.
~ John Maynard Keynes (born: 1883-06-05 died: 1946-04-21 at age: 62)