Is there an API to get a classpath resource (e.g. what I’d get from Class.getResource(String)
) as a java.nio.file.Path
? Ideally, I’d like to use the fancy new Path
APIs with classpath resources.
Advertisement
Answer
This one works for me:
return Path.of(ClassLoader.getSystemResource(resourceName).toURI());