Here you can find the source of getPath(Class> baseClass, String resourceName)
static public Path getPath(Class<?> baseClass, String resourceName) throws FileNotFoundException, URISyntaxException
//package com.java2s; //License from project: Apache License import java.io.*; import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; public class Main { static public Path getPath(Class<?> baseClass, String resourceName) throws FileNotFoundException, URISyntaxException { URL url = baseClass.getResource(resourceName); if (url == null) { throw new FileNotFoundException(String.format( "Resource file is not found. %s", resourceName)); }// w w w. jav a 2 s . co m return Paths.get(url.toURI()); } }