code: public void updateLastVersion(final String _userName,
                                    final String _password,
                                    final Set<Profile> _profiles)
          throws Exception
      {
          // reload cache (if possible)
          reloadCache();
  
          // load installed versions
          Context.begin();
          EFapsClassLoader.getOfflineInstance(getClass().getClassLoader());
          final Map<String, Integer> latestVersions = this.install.getLatestVersions();
          Context.rollback();
          final long latestVersion = latestVersions.get(this.application);
  
          final ApplicationVersion version = getLastVersion();
          if (version.getNumber() == latestVersion) {
              Application.LOG.info("Update version '{}' of application '{}' ", version.getNumber(), this.application);
  
              version.install(this.install, version.getNumber(), _profiles, _userName, _password);
  
              Application.LOG.info("Finished update of version '{}'", version.getNumber());
          } else {
              Application.LOG.error("Version {}' of application '{}'  not installed and could not updated!",
                              version.getNumber(), this.application);
          }
      }
docs: Updates the last installed version.
  
  @param _userName name of logged in user
  @param _password password of logged in user
  @param _profiles Profiles to be applied
  @throws Exception on error