jar installation standards
Nic Ferrier
nferrier@tapsellferrier.co.uk
Mon Feb 25 13:30:00 GMT 2002
Per Bothner <per@bothner.com> writes:
> There are two approaches that appeal to me:
>> (1) Just add every .jar in $prefix/share/java to the implied
> (boot-)classpath. I.e. we treat the directory like Sun treats
> its extensions directory. The advantage is simplicity for
> installers, users, plus compativility with Sun's model.
> The disadvantage is that one could imagine hundreds of jars
> being installed, and opening and reading the directory of each of
> these could be slow. On the other hand, if we only need to do the
> search at compile-time, perhaps its not a big deal. Plus we can use
> some heuritcs, perhaps built into gcj, to only open a jar if we
> think we might need it (e.g. after searching libgcj).
>> One complication is dealing with symlinks and versioning. If the
> dirctory contains servlet-2.3.jar, servlet-2.1.jar, servlet-2.jar,
> and servlet.jar (a symlink); the compiler should pick the least
> specific one, i.e. servlet.jar, and skip the others.
>> (2) Use package-style names, similar to what we do for .so files.
> The search algorithm when searching for class foo.bar.Baz:
> - Search the user classpath.
> - Search libgcj.jar.
> - Look for foo-bar.jar; if found search it. Otherwise, look for
> foo.jar, and if found search it. The compiler should explicitly
> resolve symlinks (rather than have the OS do it) in case two symlinks
> (eg foo-bar1.jar and foo.bar2.jar) point to the same file.
How about a variation on the first one?
Provide a variable EXTENSIONPATH which contains a list of the
directories which include extensions. Each jar file in each
extension directory is loaded on demand.
There would be a default EXTENSIONPATH which would be:
/usr/share/java:/usr/local/share/java
What I would *really* like is just an -extpath option on the command
line where I could specify a path. An extpath is easily constructed.
Btw, it's also pretty easy to construct an extpath from a classpath,
I use this:
gcj -classpath `ls /usr/local/share/java/*.jar | tr [:space:] :`
Nic
More information about the Java
mailing list