db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Watts <...@cliftonfarm.org>
Subject Re: derby.jar Classpath
Date Tue, 17 Jul 2012 14:31:11 GMT
On Tue, 2012-07-17 at 05:56 -0700, Rick Hillegas wrote:
> On 7/17/12 3:23 AM, Peter Davis wrote:
> > Hi
> >
> > I've been using derby db for a while now and have until now been 
> > willing to work around a problem with classpath.  It appears that I 
> > have to explicitly place derby.jar on the class path using one of the 
> > standard mechanisms. e.g. -cp  or in the manifest of the running jar. 
> >  Unfortunately my application uses its own class loader and therefore 
> > none of the above is true.
> >
> > I'm guessing that derby.jar uses the property "java.class.path" to 
> > find the path to its other components.
> Hi Peter,
> Note that the engine jar file (derby.jar) only depends on the jar files 
> which contain the message localizations. Derby still runs even if it 
> can't find the localizations--error messages will just come out in 
> English rather than the preferred language of your platform. The engine 
> jar file does not depend on any of the other executable jars 
> (derbyclient.jar, derbynet.jar, derbytools.jar). Here is the Class-Path 
> attribute from derby.jar:
> Class-Path: derbyLocale_cs.jar derbyLocale_de_DE.jar derbyLocale_es.ja
>   r derbyLocale_fr.jar derbyLocale_hu.jar derbyLocale_it.jar derbyLocal
>   e_ja_JP.jar derbyLocale_ko_KR.jar derbyLocale_pl.jar derbyLocale_pt_B
>   R.jar derbyLocale_ru.jar derbyLocale_zh_CN.jar derbyLocale_zh_TW.jar
> The Derby network JDBC driver (derbyclient.jar) and the Derby tools 
> (derbytools.jar) also depend on the localization jar files. They have 
> the same Class-Path attribute as derby.jar.
> The only jar files which pull in more executable code are the Derby 
> network server (derbynet.jar) and the convenience jar file which was 
> designed to simplify classpath administration (derbyrun.jar). The 
> network server depends on the engine jar file. Here is it's Class-Path 
> attribute...
> Class-Path: derby.jar
> ...and here is the Class-Path attribute of derbyrun.jar:
> Class-Path: derby.jar derbyclient.jar derbytools.jar derbynet.jar
> >
> > So my question is, Is there a way to load derby.jar without explicitly 
> > declaring it on the classpath.
> People who actually deploy applications can offer better advice than I 
> can. My only suggestions would be:
> 1) Wire the location of derby.jar into the Class-Path attribute in the 
> manifest file of your application's jar file.
> 2) Hardwire knowledge of derby.jar into your custom class loader.
Or modify your class loader to scan jars for the Class-Path attribute
and include those items in its search path -- bearing in mind that the
items are relative to the location of the jar in question. It should
probably do this anyway since it's not uncommon for jars to use this
standard approach of expressing dependencies.  See the jar api and
manifest spec in the jdk documentation.  I'm sure this wheel has already
been invented so you might want to look around for examples (e.g.
possibly Tomcat's webapp classloader).

> Hope this helps,
> -Rick
> >
> > Peter

View raw message