URL url = SecurityActions.getContextClassLoader().getResource(classFile);
if (!url.getProtocol().equals("file"))
{
throw new RuntimeException(".class file must not be in a jar: " + url.toString());
}
byte[] byteCode = ctClass.toBytecode();
String path = URLDecoder.decode(url.getFile(), "UTF-8");
File fp = new File(path);
FileOutputStream os = new FileOutputStream(fp);
os.write(byteCode);
os.close();