import java.io.File; import java.net.URL; import java.net.URLClassLoader; public class Lab1 { public static void main(String[] s) { for(String a: s) System.out.println(a); System.out.println("Все классы, находящиеся в текущем classpath: "); try { ClassLoader cLoader = ClassLoader.getSystemClassLoader(); if(cLoader != null) for(URL url : ((URLClassLoader)cLoader).getURLs()) { File directory = new File(url.getPath()); if (directory.exists()) { String[] files = directory.list(); if(files != null) for (String fileName : files) { if (fileName.endsWith(".class")) { fileName = fileName.substring(0, fileName.length() - 6); try { System.out.println(Class.forName(fileName)); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } } } } catch(Exception e) { e.printStackTrace(); } } }