[Index]

url-class-loader


A simple wrapper for URLClassloader.

The class loader is created when this type is configured, and the same class loader is then shared with all jobs that reference this type. Because creating numerous class loader can use up the permgen heap space it is best to avoid creating the type in a loop. Instead, add it to variables outside the loop and only reference it inside the loop.

The parent class loader will be set to Oddjob's classloader by default. To avoid this use the noInherit property.


Property Summary

files Files to add to the classpath.
noInherit Don't inherit the parent class loader.
parent The parent class loader to inherit.
urls URLs to add to the classpath.

Example Summary

Example 1 A simple example.
Example 2 Forcing the platform class loader as a parent.

Property Detail

files

Configured ByELEMENT
AccessREAD_WRITE
RequiredNo.

Files to add to the classpath.

noInherit

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

Don't inherit the parent class loader.

parent

Configured ByELEMENT
AccessREAD_WRITE
RequiredNo, defaults to any existing Oddjob class loader.

The parent class loader to inherit.

urls

Configured ByELEMENT
AccessREAD_WRITE
RequiredNo.

URLs to add to the classpath.


Examples

Example 1

A simple example. A single directory is added to the class path.

<oddjob id="oddjob">
    <job>
        <oddjob id="nested" file="${oddjob.dir}/URLClassLoaderInner.xml">
            <classLoader>
                <url-class-loader>
                    <files>
                        <file file="${oddjob.args[0]}/test/classloader"/>
                    </files>
                </url-class-loader>
            </classLoader>
        </oddjob>
    </job>
</oddjob>

Example 2

Forcing the platform class loader as a parent. When migrating to Java 9 classes such as java.sql.date will no longer load with the no parent class loader. See Migrating to JDK 9 for more information.


(c) R Gordon Ltd 2005 - Present