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.
| 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 1 | A simple example. |
| Example 2 | Forcing the platform class loader as a parent. |
| Configured By | ELEMENT |
| Access | READ_WRITE |
| Required | No. |
Files to add to the classpath.
| Configured By | ATTRIBUTE |
| Access | READ_WRITE |
| Required | No. |
Don't inherit the parent class loader.
| Configured By | ELEMENT |
| Access | READ_WRITE |
| Required | No, defaults to any existing Oddjob class loader. |
The parent class loader to inherit.
| Configured By | ELEMENT |
| Access | READ_WRITE |
| Required | No. |
URLs to add to the classpath.
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>
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.