mirror of
https://github.com/corda/corda.git
synced 2025-01-04 04:04:27 +00:00
search for jar file in Zip.java instead of trying to load by hard-coded name
This commit is contained in:
parent
0456a9fd49
commit
88942a9672
@ -1,12 +1,31 @@
|
||||
import java.io.InputStream;
|
||||
import java.io.File;
|
||||
import java.util.Enumeration;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
public class Zip {
|
||||
|
||||
private static String findJar(File directory) {
|
||||
File[] files = directory.listFiles();
|
||||
for (File file: directory.listFiles()) {
|
||||
if (file.isFile()) {
|
||||
if (file.getName().endsWith(".jar")) {
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
} else if (file.isDirectory()) {
|
||||
String result = findJar(file);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ZipFile file = new ZipFile("build/classpath.jar");
|
||||
ZipFile file = new ZipFile
|
||||
(findJar(new File(System.getProperty("user.dir"))));
|
||||
|
||||
byte[] buffer = new byte[4096];
|
||||
for (Enumeration<? extends ZipEntry> e = file.entries();
|
||||
|
Loading…
Reference in New Issue
Block a user