db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <rick.hille...@oracle.com>
Subject Re: derby.jar Classpath
Date Tue, 17 Jul 2012 12:56:24 GMT
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 

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.

Hope this helps,
> Peter

View raw message