Here you can find the source of getResource(final String resource)
public static URI getResource(final String resource) throws URISyntaxException
//package com.java2s; //License from project: Apache License import java.net.URI; import java.net.URISyntaxException; public class Main { public static URI getResource(final String resource) throws URISyntaxException { return getClassLoader().getResource(resource).toURI(); }//www . jav a 2s . c om private static ClassLoader getClassLoader() { return Thread.currentThread().getContextClassLoader(); } }