Why not subclass URLClassLoader and expose addURL using that class instead of setAccessible - in general, it is not a good idea to use setAccessible; typically used for testing and in some non standard cases.