读取URL文件
/** 来 自 N o w J a v a . c o m**/ //package com.nowjava; import java.net.URL; public class Main { public static void main(String[] argv) throws Exception { Class classType = String.class; String fileName = "nowjava.com"; System.out.println(getURLFile(classType, fileName)); } public static URL getURLFile(Class<?> classType, String fileName) {/*时 代 J a v a - nowjava.com*/ URL fileURL = classType.getClassLoader().getResource(fileName); return fileURL; } }