private static Path getPathFromClass(Class<?> klass) {
    String klassFileName = klass.getName().replace(klass.getPackageName() + ".", "");
    final URL classFileURL = klass.getResource(klassFileName + ".class");
    if (classFileURL == null) {
      throw new IllegalStateException("Could not get .class file location from class " + klass.getName());
    }
    return Path.of(UrlClassLoader.urlToFilePath(classFileURL.getPath()));
  }
private static Path getPathFromClass(Class<?> klass)