java.nio.file.Path for a classpath resource October 21, 2022 by Tarik This one works for me: return Path.of(ClassLoader.getSystemResource(resourceName).toURI());