1

Hello so I have made an Jar updater and it is working perfect the only issue i am having is that if the client is named different it will download it as a separate jar file and not replace the one you are running so this is where i get my client location and name

private static String myClient = System.getProperty("user.dir") + File.separator  + "Trinity.jar";

Now i was wondering how do i get the name of the jar that has been ran on startup so i can use it to replace the old jar file correctly

1 Answers1

2

Java provides MyClass which contains all the attributes of the current class's context which includes runtime information. Using the right combination utility functions can yield you the required path.

Path = MyClass.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();