Splitting package among different jars

S

Sam Takoy

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
 
A

Andreas Leitgeb

Sam Takoy said:
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.
 
L

Lew

Andreas said:
It can and will, iff you deal with "sealed" packages.
...
http://java.sun.com/docs/books/tutorial/deployment/jar/sealman.html
Sam said:
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 said:
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.
 
A

Arne Vajhøj

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
 
R

Roedy Green

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top