}
JarFileWriter jarFileWriter = new JarFileWriter();
jarFileWriter.writeJarFile(lib, name + ".jar", new File(temp.getAbsolutePath() + File.separator + "classes"));
Project project = codegenBean.getActiveProject();
final LibraryTable table = (LibraryTable) project.getComponent(LibraryTable.class);
ApplicationManager.getApplication().runWriteAction(new
Runnable() {
public void run() {
String url = VirtualFileManager.constructUrl(JarFileSystem.PROTOCOL, lib.getAbsolutePath() + File.separator + name + ".jar") + JarFileSystem.JAR_SEPARATOR;
VirtualFile jarVirtualFile = VirtualFileManager.getInstance().findFileByUrl(url);
Library myLibrary = table.createLibrary(name);
Library.ModifiableModel libraryModel = myLibrary.getModifiableModel();
libraryModel.addRoot(jarVirtualFile, OrderRootType.CLASSES);
libraryModel.commit();
}