Re: Is there a solution to my problem? (Re: Symlinking jars is dangerous (Re: The evils of /usr/share/java/repository))
On Wed, Sep 19, 2001 at 09:21:15AM +0200, Ola Lundqvist wrote:
> On Wed, Sep 19, 2001 at 09:59:09AM +1000, Jeff Turner wrote:
> > On Tue, Sep 18, 2001 at 02:15:04PM -0700, Bill Wohler wrote:
> > Symlinking jars can be dangerous, because jars can contain a Class-path:
> > line in their manifests. These Class-path: lines contain relative
> > references to other jars. This causes two problems:
> What does this reference mean? Is it the same as adding that jar to
> the classpath?
I think so.
> Does it exist only in java2?
Unfortunately yes. It was introduced as part of the 1.2 "extension
> If this is the case we have the solution on the dependency problem!!!
> We should just have a policy on how to name them. :)
Hmm.. so packagers would open all program jars, twiddle their manifests,
close them again and then their classpath should be automatically
determined? Might work, except for the fact that it's not in 1.2, and it
might break the startup script.
> > - If the packager has gone and renamed the jar, then Class-path:
> > references in other jars will break.
> > - The Class-path: reference is relative (may contain ".."). Say you
> > have /usr/share/java/jaxp.jar, and symlink it to your VM's lib/ext
> > directory. Those relative Class-path: references are going to be
> > relative to /usr/share/java, *not* your VM directory. So even if you
> > symlink one jar to lib/ext, that jar may haul in a bunch of other
> > jars.
> The policy should say that every Class-path: must be relative to the
> /usr/share/java dir. Which means that they should (almost all time)
> just be the jar filename.
An excellent idea.
> > Here's someone who just got burnt by symlinking jdom.jar:
> And they should of course just point to packaged jars.
> > http://www.servlets.com/archive/servlet/ReadMsg?msgId=143649&listName=jdom-interest
> > "I've just spent several days tracking a nasty CLASSPATH problem
> > created by an entry in the Beta 7 MANIFEST.MF entry.
> > ..
> > What makes this so evil is that the JVM's under Linux resolve symbolic
> > links. When an symbolic link to jdom.jar is placed in some project's
> > lib directory, both Linux JVM's still load the ../lib/xerces.jar
> > RELATIVE to the REAL jdom.jar file."
> So we should really say something about this in the policy. :)
I agree. It's something package maintainers need to know, in case they
decide to rename a jar.
> // Ola