document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.     public static void restartJarApplication(Class appClass) {
  2.         try {
  3.             final String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
  4.             final File currentJar = new File(appClass.getProtectionDomain().getCodeSource().getLocation().toURI());
  5.  
  6.             /* Build command: java -jar application.jar */
  7.             final ArrayList<String> command = new ArrayList<String>();
  8.             command.add(javaBin);
  9.             command.add("-jar");
  10.             command.add(currentJar.getPath());
  11.  
  12.             final ProcessBuilder builder = new ProcessBuilder(command);
  13.             builder.start();
  14.             System.exit(0);
  15.         } catch (URISyntaxException ex) {
  16.             Logger.getLogger(MyClass.class.getName()).log(Level.SEVERE, null, ex);
  17.         } catch (IOException ex) {
  18.             Logger.getLogger(MyClass.class.getName()).log(Level.SEVERE, null, ex);
  19.         }
  20.     }
');