티스토리 뷰
JarScan j = new JarScan("C:/tmp");
j.search("umaUtils");
}
------------------------------
import java.io.File;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
public class JarScan {
private String path = "";
private String ptn = "";
private int cnt = 0;
public JarScan(String path) {
this.path = path;
}
public void search(String findString) {
this.ptn = findString;
subScanDir(path);
System.out.println("Complete: " + cnt + "Files");
}
private void subScanDir(String path) {
File f = new File(path);
File[] fileList = f.listFiles();
if(fileList != null) {
for(File fs : fileList) {
if(fs.isDirectory()) {
subScanDir(path + "/" + fs.getName());
}else {
String fileName = fs.getName().toLowerCase();
if(fileName.lastIndexOf(".jar") != -1) {
readJarFile(path + "/" + fs.getName());
}
}
}
}
}
private void readJarFile(String fileName) {
JarFile jar = null;
boolean flag = false;
try {
jar = new JarFile(fileName);
if(jar != null) {
Enumeration<JarEntry> entry = jar.entries();
if(entry != null) {
while(entry.hasMoreElements()) {
JarEntry e = entry.nextElement();
if(!e.isDirectory()) {
if(e.getName().indexOf(this.ptn) != -1) {
if(!flag) {
System.out.println(++cnt + ") " + fileName);
flag = true;
}
System.out.println(" " + e.getName());
}
}
}
}
}
}catch(Exception e) {
e.printStackTrace();
}finally {
if(jar != null) try { if(jar != null) jar.close(); } catch(Exception e1) { }
}
}
}
'장난감 정리 중' 카테고리의 다른 글
| OpenGL 사용하기 (0) | 2010.08.17 |
|---|---|
| 심플한 Tetris를 만들어 보자 - 화면에 이미지를 그려봐요. (0) | 2010.08.16 |
| redmine 을 설치하다. (0) | 2010.07.08 |
| badaSDK로 만든 binary를 bada시뮬레이터에 띄워보자는 취지 (0) | 2010.06.10 |
| MAC에서 weblogic을 돌려보자. (0) | 2010.01.06 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- ollama
- capture
- regexp
- cudnn
- Swift Package Manager
- Bada
- CI
- javascript
- CUDA
- GNUStep
- VCL
- jupyter
- IHTMLElement
- Eclipse
- java
- TensorFlow
- 한영전환
- BCB
- Copilot
- Python
- hosts
- Profiler
- 프로젝트
- SCM
- FindWindows
- Xcode
- IViewObject
- CppWebBrowser
- TShellWindows
- Atom
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
| 28 | 29 | 30 |
글 보관함