==[[Java パッケージ配下のクラスを取得する]]==[[Java]] | {{category [[Category:コード片}}]]
/**
public void getClassesInPackage(Package package) throws Exception {
final char PACKAGE_SEP = '.';
final char PACKAGE_RESOURCE_SEP PACKAGE_[[R]]ESOU[[R]]CE_SEP = '/';
String packageName = package.getName();
String packageResource package[[R]]esource = packageName.replace(PACKAGE_SEP, PACKAGE_RESOURCE_SEPPACKAGE_[[R]]ESOU[[R]]CE_SEP);
logger.info("RESOURCE[[R]]ESOU[[R]]CE:" + packageResourcepackage[[R]]esource);
ClassLoader loader = ClassLoader.getSystemClassLoader();
URL U[[R]]L resource = loader.getResourceget[[R]]esource(packageResourcepackage[[R]]esource);
File f = new File(resource.getPath());