### Jar List Content

A Jar file has the same format as a Zip file.
To list the content, various options.
List Content using Zip Reader
Rename the Jar file to a Zip file, like myjar.jar to myjar.zip
Then unzip myjar.zip
List Content using Inline Java
To list the content of a Jar file archive, this is a solution using Inline Java (requires the JavaObject library).
If JAVA
import java.io.*;
import java.util.*;
import java.util.zip.*;
//List the content of a jar archive
//Example of getting the File Assets from a Jar - which are stored in the Files folder:
// Dim f As List = joFiles.RunMethod("JarContent", Array(""))
// If f = Null Then Return
// Log("Total number of files found in the Jar: " & f.size)
// Log("Asset Files:")
// For i = 0 To f.size - 1
// Dim s As String = f.Get(i)
// If s.StartsWith("Files") Then Log(f.Get(i))
// Next
//
public static List JarContent(String searchpath) {
List files = new ArrayList();
try {
ZipFile zipFile = new ZipFile(searchpath);
Enumeration zipEntries = zipFile.entries();
while (zipEntries.hasMoreElements()) {
//System.out.println(zipEntries.nextElement().getName());
files.add(zipEntries.nextElement().getName());
}
return files;
} catch (IOException ioe) {
ioe.printStackTrace();
return null;
}
}

Changed: , Category: Jar, File: T6C204M1501.htm, ID: 1501