private File getThisDirectory()
throws FileNotFoundException{
Class c = getClass();
String classFileName = c.getName();
classFileName = classFileName.substring(classFileName.lastIndexOf(".") + 1);
classFileName += ".class";
String classFilePath = c.getResource(classFileName).getFile();
String jarFilePath = classFilePath.substring("file:/".length(),
classFilePath.lastIndexOf("!"));
File directory = new File(jarFilePath);
directory = new File(directory.getParent());
try{
directory = new File(new java.net.URLDecoder().decode(directory.getAbsolutePath(),
fileEncoding));
return directory;
}catch(UnsupportedEncodingException e){
throw new RuntimeException("File encoding \"" + fileEncoding
+ "\" is not supported");
}
}