Just beware that there is no documented standard format for `CodeSource.location`. `URLClassLoader` actually accepts two formats: `file:…/code.jar` and `jar:file:…/code.jar!/`. The second one is more logical—code sources ought to be directory URLs to which you can append resource URIs, creating a URL such as `jar:file:…/code.jar!/pkg/Some.class`. But both forms are found “in the field”, so you should explicitly check for the one using the `jar` URL protocol and strip off the `jar:` prefix and `!/` suffix before trying to call `File.<init>(URI)` (which will throw an `IllegalArgumentException` if given the `jar`-protocol form), though currently Jenkins uses `AntClassLoader` whose `defineClassFromData` uses the `file`-protocol form, or `PluginFirstClassLoader` whose `addPathFiles` does the same. See [this code](http://hg.netbeans.org/main/file/default/openide.filesystems/src/org/openide/filesystems/FileUtil.java#l1992) for example.