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.
This one works for me:
return Paths.get(ClassLoader.getSystemResource(resourceName).toURI());