All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.undefinedlabs.scope.utils.JarUtils Maven / Gradle / Ivy

package com.undefinedlabs.scope.utils;

import java.security.CodeSource;

public class JarUtils {

  public static String resolveJarName(final Class clazz) {
    final CodeSource codeSource = clazz.getProtectionDomain().getCodeSource();
    if (codeSource != null) {
      final String path = codeSource.getLocation().getPath();
      return path.substring(path.lastIndexOf('/') + 1).replace(".jar", "");
    }

    return "unknown";
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy