daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Jun 25th, 2018 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void restartApplication()
  2. {
  3.   final String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
  4.   final File currentJar = new File(UpdateReportElements.class.getProtectionDomain().getCodeSource().getLocation().toURI());
  5.  
  6.   /* is it a jar file? */
  7.   if(!currentJar.getName().endsWith(".jar"))
  8.     return;
  9.  
  10.   /* Build command: java -jar application.jar */
  11.   final ArrayList<String> command = new ArrayList<String>();
  12.   command.add(javaBin);
  13.   command.add("-jar");
  14.   command.add(currentJar.getPath());
  15.  
  16.   final ProcessBuilder builder = new ProcessBuilder(command);
  17.   builder.start();
  18.   System.exit(0);
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top