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));
    }
  }
  private IStatus generateJar(String jarPath) {
    MultiStatus status =
        new MultiStatus(Plugin.PLUGIN_ID, 0, "Errors occurred during exporting.", null);
    ProjectLauncher launcher = null;
    try {
      launcher = bndProject.getProjectLauncher();
    } catch (Exception e) {
      status.add(
          new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error getting project launcher.", e));
    }

    try {
      Jar jar = launcher.executable();
      jar.write(jarPath);
    } catch (Exception e) {
      status.add(
          new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error generating executable JAR.", e));
    }
    return status;
  }