final ClassLoader p = parentClassLoader;
MapBackedClassLoader loader = AccessController.doPrivileged( new PrivilegedAction<MapBackedClassLoader>() {
public MapBackedClassLoader run() {
return new MapBackedClassLoader( p );
}
});
try {
for ( JarInputStream jis : classpath ) {
JarEntry entry = null;
byte[] buf = new byte[1024];
int len = 0;
while ( (entry = jis.getNextJarEntry()) != null ) {
if ( !entry.isDirectory() ) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
while ( (len = jis.read( buf )) >= 0 ) {
out.write( buf, 0, len );
}
loader.addResource( entry.getName() , out.toByteArray() );
}
}
}
} catch ( IOException e ) {