Here you can find the source of getLoadingDir(Class clazz)
@SuppressWarnings("rawtypes") public static File getLoadingDir(Class clazz)
//package com.java2s; //License from project: LGPL import java.io.File; import java.net.URISyntaxException; public class Main { @SuppressWarnings("rawtypes") public static File getLoadingDir(Class clazz) { try {/* www . j av a2 s . c o m*/ return new File(clazz.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()); } catch (URISyntaxException e) { return null; } } }