Nice, mine differs slightly:
Gotta have a manifest to make it runnable xD
Code:
public static void dumpJar(List<ClassNode> classes, Manifest manifest, String absolutePath) {
try (JarOutputStream jos = new JarOutputStream(new FileOutputStream(new File(absolutePath)), manifest)) {
for (ClassNode cn : classes) {
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
jos.putNextEntry(new JarEntry(cn.name + ".class"));
cn.accept(writer);
jos.write(writer.toByteArray());
}
} catch (IOException e) {
e.printStackTrace();
}
}
Gotta have a manifest to make it runnable xD