Fixed jar reference with spaces in path

This commit is contained in:
coolGi
2023-10-03 22:48:04 +10:30
parent 877b0dae25
commit e966d40ae2
@@ -34,7 +34,21 @@ import java.util.Objects;
*/
public class JarUtils
{
public static final File jarFile = new File(JarUtils.class.getProtectionDomain().getCodeSource().getLocation().getPath());
public static File jarFile = null;
static {
try {
jarFile = new File(JarUtils.class.getProtectionDomain().getCodeSource().getLocation().toURI()); // Always safe
}
catch (Exception e)
{
e.printStackTrace();
}
}
public static void main(String[] args) {
System.out.println(jarFile);
}
/**