jar文件搜索 有很多的jar包,现在我需要找到javax.rmi.PortableRemoteObject类在哪个jar包中,并且将它导入classpath中。有什么相关的工具或者命令么? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public void searchZip(File file, String fileName) { try { ZipInputStream zip = new ZipInputStream(new FileInputStream(file)); ZipEntry ze; fileName=fileName.toLowerCase(); while ((ze = zip.getNextEntry()) != null) { String name = ze.getName().toLowerCase(); searching(file.getAbsolutePath() + "$" + ze.getName()); if (name.indexOf(fileName) > -1 || getMatch(name, fileName)) { System.out.println(file.getAbsolutePath() + "$" + name); } zip.closeEntry(); } zip.close(); } catch (IOException e) { } }private boolean getMatch(String str1, String str2) { if (str1 == null || str2 == null) return false; while (str2.indexOf('*') > -1) str2 = str2.replace('*', '/'); str2 = str2.replaceAll("/", ".*"); return str1.matches(str2); } searching(file.getAbsolutePath() + "$" + ze.getName());这句话多了 redirectPort有什么用途哦? 怎样清理JAVA屏幕打印信息? 一个面试题,该怎么做 帮帮看看这个字符串 论坛 JTree节点名字修改? 我是新手,请高手帮助 请教高手HTTPURLConnection的问题 为什么这样会找不到当前目录下的文件File myfile = new File("test.txt"); 谢谢 如何让表格jtable的头部能够在点击后有排序功能? 为什么不能实现查询功能!!! swing 进度条 等待操作
public void searchZip(File file, String fileName) {
try {
ZipInputStream zip = new ZipInputStream(new FileInputStream(file));
ZipEntry ze;
fileName=fileName.toLowerCase();
while ((ze = zip.getNextEntry()) != null) {
String name = ze.getName().toLowerCase();
searching(file.getAbsolutePath() + "$" + ze.getName());
if (name.indexOf(fileName) > -1 || getMatch(name, fileName)) {
System.out.println(file.getAbsolutePath() + "$" + name);
}
zip.closeEntry();
}
zip.close();
} catch (IOException e) {
}
}
private boolean getMatch(String str1, String str2) {
if (str1 == null || str2 == null)
return false;
while (str2.indexOf('*') > -1)
str2 = str2.replace('*', '/');
str2 = str2.replaceAll("/", ".*");
return str1.matches(str2);
}