private void generateLauncherJar(ProjectLauncher launcher, File folder, MultiStatus status) { Jar launcherJar = new Jar("launch"); // Merge in the classpath JARs Collection<String> classpath = launcher.getClasspath(); for (String classpathEntry : classpath) { try { Jar classpathJar = new Jar(new File(classpathEntry)); launcherJar.addAll(classpathJar); } catch (IOException e) { status.add( new Status( IStatus.ERROR, Plugin.PLUGIN_ID, 0, String.format("Failed to add classpath JAR '%s'.", classpathEntry), e)); } } // Set the Main-Class Manifest manifest = new Manifest(); manifest.getMainAttributes().putValue("Main-Class", "launch"); launcherJar.setManifest(manifest); launcherJar.putResource( "launch.class", new URLResource(ExecutableJarExportWizard.class.getResource("launch.clazz"))); try { launcherJar.write(new File(folder, "launch.jar")); } catch (Exception e) { status.add(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error generating launch JAR.", e)); } }