Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. package pl.blazingpack.launcher;
  2.  
  3. import java.io.File;
  4. import java.lang.reflect.Method;
  5. import java.net.URI;
  6. import java.net.URL;
  7. import java.net.URLClassLoader;
  8. import java.nio.file.Files;
  9. import java.nio.file.Path;
  10. import java.nio.file.Paths;
  11. import java.security.CodeSource;
  12. import java.security.ProtectionDomain;
  13.  
  14. public class BlazingPackLauncher {
  15. public static boolean isUpdating = false;
  16.  
  17. public static void main(String[] args) throws Throwable {
  18. do {
  19. File d = Paths.get(BlazingPackLauncher.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toFile().getParentFile();
  20. File u = new File(d, String.valueOf(d.getName()) + "App.jar.new");
  21. File o = new File(d, String.valueOf(d.getName()) + "App.jar");
  22. if (u.exists()) {
  23. Files.delete(o.toPath());
  24. u.renameTo(o);
  25. }
  26. URLClassLoader ucl = new URLClassLoader(new URL[]{o.toURI().toURL()}, BlazingPackLauncher.class.getClassLoader());
  27. ucl.loadClass("net.minecraft.client.main.Main").getDeclaredMethod("main", String[].class).invoke(null, new Object[]{args});
  28. ucl.close();
  29. } while (isUpdating);
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement