Java examples for Reflection:Class Loader
get Absolute Path for class loader
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { String path = "java2s.com"; System.out.println(getAbsolutePath(path)); }/*www.j a va2 s . c o m*/ public static String getAbsolutePath(String path) { ClassLoader classLoader = ClassLoader.getSystemClassLoader(); String absolutePath = classLoader.getResource(path).getFile(); return absolutePath; } }