System.out.println("目前類ReadTest.class檔案的URI\n" + ReadTest.class.getResource(""));
System.out.println("目前classpath的URI\n" + ReadTest.class.getResource("/"));
System.out.println("目前classpath的URI\n" + ReadTest.class.getClassLoader().getResource(""));
System.out.println("目前classpath的URI\n" + Thread.currentThread().getContextClassLoader().getResource(""));
System.out.println("目前classpath的URI\n" + ClassLoader.getSystemResource(""));
原文:http://www.cnblogs.com/pumushan/p/5630886.html