-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathListDependency.java
More file actions
27 lines (24 loc) · 876 Bytes
/
ListDependency.java
File metadata and controls
27 lines (24 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.util.stream.Stream;
import java.util.stream.Collectors;
public class ListDependency{
public static void main(String[] args) {
List<String> deps = new ArrayList<String>();
String libDir = "lib";
File dir = new File(libDir);
if (dir.exists() && dir.isDirectory()) {
File[] files = dir.listFiles((d, name) -> name.endsWith(".jar"));
if (files != null) {
for (File file : files) {
deps.add(file.getName());
}
}
}
// let'use join the list with ":" and libDir/ prefix
String listString = deps.stream().map(name -> libDir + "/" + name).collect(Collectors.joining(":"));
System.out.println(listString);
}
}