Code example for Path

Methods: getFileNametoUri

0
 
    private static void addClassPath(File classpath, final List<URL> urls) throws IOException {
        Files.walkFileTree(classpath.toPath(), new SimpleFileVisitor<Path>(){
            @Override 
            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                String name = file.getFileName().toString();
                if(name.endsWith(".jar") || name.endsWith(".car")){
                    urls.add(file.toUri().toURL());
                } 
                return FileVisitResult.CONTINUE;
            } 
        }); 
    } 
 
    @SuppressWarnings("deprecation") 
    public static void main(String[] args) throws Exception {
        File systemClasspath = new File(SystemRepo);
        File libClasspath = new File(FlatRepoLib);
         
        List<URL> urls = new LinkedList<URL>();