protected void setEnvironmentVariable(
      CloudFoundryApplicationModule appModule,
      CloudFoundryServer cloudServer,
      int remoteDebugPort,
      IProgressMonitor monitor)
      throws CoreException {

    ApplicationDeploymentInfo info = appModule.getDeploymentInfo();
    List<EnvironmentVariable> vars = info.getEnvVariables();
    EnvironmentVariable javaOpts = getDebugEnvironment(info);

    IModule[] mod = new IModule[] {appModule.getLocalModule()};

    boolean restart = CloudFoundryProperties.isModuleStopped.testProperty(mod, cloudServer);

    if (!containsDebugOption(javaOpts)) {

      if (javaOpts == null) {
        javaOpts = new EnvironmentVariable();
        javaOpts.setVariable(JAVA_OPTS);
        vars.add(javaOpts);
      }

      String debugOpts =
          "-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address="
              + remoteDebugPort //$NON-NLS-1$
              + ",suspend=n"; //$NON-NLS-1$
      javaOpts.setValue(debugOpts);

      cloudServer
          .getBehaviour()
          .operations()
          .environmentVariablesUpdate(
              appModule.getLocalModule(), appModule.getDeployedApplicationName(), vars)
          .run(monitor);

      restart = true;
    }

    if (restart) {
      printToConsole(
          appModule,
          cloudServer,
          NLS.bind(
              Messages.SshDebugLaunchConfigDelegate_RESTARTING_APP,
              appModule.getDeployedApplicationName()),
          false);

      cloudServer
          .getBehaviour()
          .operations()
          .applicationDeployment(mod, ApplicationAction.START, false)
          .run(monitor);
    }
  }
  protected JarPackageData getJarPackageData(
      IPackageFragmentRoot[] roots, IType mainType, IProgressMonitor monitor) throws CoreException {

    String filePath = getTempJarPath(appModule.getLocalModule());

    if (filePath == null) {
      handleApplicationDeploymentFailure();
    }

    IPath location = new Path(filePath);

    // Note that if no jar builder is specified in the package data
    // then a default one is used internally by the data that does NOT
    // package any jar dependencies.
    JarPackageData packageData = new JarPackageData();

    packageData.setJarLocation(location);

    // Don't create a manifest. A repackager should determine if a generated
    // manifest is necessary
    // or use a user-defined manifest.
    packageData.setGenerateManifest(false);

    // Since user manifest is not used, do not save to manifest (save to
    // manifest saves to user defined manifest)
    packageData.setSaveManifest(false);

    packageData.setManifestMainClass(mainType);
    packageData.setElements(roots);
    return packageData;
  }