@Test public void testOneEntry() throws IOException { File entry = tmpFolder.newFolder("oneentry"); String rawEntry = entry.getAbsolutePath(); List<String> classPathEntries = ClassPaths.getClassPathEntries(rawEntry); assertThat(classPathEntries, contains(entry.getAbsolutePath())); }
public static List<String> getClassPathEntries(String classPath) { List<String> entries = new ArrayList<>(); if(classPath.isEmpty()){ return entries; } for(String rawEntry : classPath.split(File.pathSeparator)) { File file = new File(rawEntry); if(file.exists()) { if(file.isDirectory()) { for(File jarFile : file.listFiles((File f) -> f.isFile() && f.getName().endsWith(".jar"))) { entries.add(jarFile.getAbsolutePath()); } } entries.add(file.getAbsolutePath()); } else { LOG.warn("ClassPath entry {} not found, will skip it.", rawEntry); } } return entries; }
ClassPaths { public static List<String> getClassPathEntries(String classPath) { List<String> entries = new ArrayList<>(); if(classPath.isEmpty()){ return entries; } for(String rawEntry : classPath.split(File.pathSeparator)) { File file = new File(rawEntry); if(file.exists()) { if(file.isDirectory()) { for(File jarFile : file.listFiles((File f) -> f.isFile() && f.getName().endsWith(".jar"))) { entries.add(jarFile.getAbsolutePath()); } } entries.add(file.getAbsolutePath()); } else { LOG.warn("ClassPath entry {} not found, will skip it.", rawEntry); } } return entries; } }
ClassPaths { public static List<String> getClassPathEntries(String classPath) { List<String> entries = new ArrayList<>(); if(classPath.isEmpty()){ return entries; } for(String rawEntry : classPath.split(File.pathSeparator)) { File file = new File(rawEntry); if(file.exists()) { if(file.isDirectory()) { for(File jarFile : file.listFiles((File f) -> f.isFile() && f.getName().endsWith(".jar"))) { entries.add(jarFile.getAbsolutePath()); } } entries.add(file.getAbsolutePath()); } else { LOG.warn("ClassPath entry {} not found, will skip it.", rawEntry); } } return entries; }  }
ClassPaths { public static List<String> getClassPathEntries(String classPath) { List<String> entries = new ArrayList<>(); if(classPath.isEmpty()){ return entries; } for(String rawEntry : classPath.split(File.pathSeparator)) { File file = new File(rawEntry); if(file.exists()) { if(file.isDirectory()) { for(File jarFile : file.listFiles((File f) -> f.isFile() && f.getName().endsWith(".jar"))) { entries.add(jarFile.getAbsolutePath()); } } entries.add(file.getAbsolutePath()); } else { LOG.warn("ClassPath entry {} not found, will skip it.", rawEntry); } } return entries; }  static List<String> getClassPathEntries(String classPath); }
ClassPaths { public static List<String> getClassPathEntries(String classPath) { List<String> entries = new ArrayList<>(); if(classPath.isEmpty()){ return entries; } for(String rawEntry : classPath.split(File.pathSeparator)) { File file = new File(rawEntry); if(file.exists()) { if(file.isDirectory()) { for(File jarFile : file.listFiles((File f) -> f.isFile() && f.getName().endsWith(".jar"))) { entries.add(jarFile.getAbsolutePath()); } } entries.add(file.getAbsolutePath()); } else { LOG.warn("ClassPath entry {} not found, will skip it.", rawEntry); } } return entries; }  static List<String> getClassPathEntries(String classPath);  }