/** * Attempts to relaunch the uninstaller with elevated permissions. * * @param platform the current platform * @return <tt>true</tt> if the relaunch was successful, otherwise <tt>false</tt> */ private static boolean relaunchWithElevatedRights(Platform platform) { boolean result = false; PrivilegedRunner runner = new PrivilegedRunner(platform); if (runner.isPlatformSupported()) { try { if (runner.relaunchWithElevatedRights() == 0) { result = true; } } catch (Exception exception) { exception.printStackTrace(); } if (!result) { JOptionPane.showMessageDialog( null, "The uninstaller could not launch itself with administrator permissions.\n" + "The uninstallation will still continue but you may encounter problems due to insufficient permissions."); } } else { JOptionPane.showMessageDialog( null, "This uninstaller should be run by an administrator.\n" + "The uninstallation will still continue but you may encounter problems due to insufficient permissions."); } return result; }