01: /*
02: * Hammurapi
03: * Automated Java code review system.
04: * Copyright (C) 2004 Johannes Bellert
05: *
06: * This program is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU General Public License as published by
08: * the Free Software Foundation; either version 2 of the License, or
09: * (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: *
20: * URL: http://www.pavelvlasov.com/pv/content/menu.show?id=products.jtaste
21: * e-Mail: Johannes.Bellert@gmail.com
22: */
23:
24: package org.hammurapi.inspectors.metrics;
25:
26: import java.io.File;
27: import java.util.StringTokenizer;
28: import java.util.Vector;
29:
30: /**
31: * @author 111001082
32: *
33:
34: */
35: public class JarFileLookup {
36:
37: public JarFileList parseClasspath() {
38: JarFileList jarFileList = new JarFileList();
39: StringTokenizer tokenizer = new StringTokenizer(System
40: .getProperty("java.class.path"), System
41: .getProperty("path.separator"));
42:
43: while (tokenizer.hasMoreTokens()) {
44: try {
45: String jarFileAbsolutePath = tokenizer.nextToken();
46: File jarFile = new File(jarFileAbsolutePath);
47: JarFile jf = new JarFile(jarFileAbsolutePath, jarFile
48: .length(), jarFile.lastModified());
49: jarFileList.add(jf);
50: // System.out.println ( jf.toString() );
51: } catch (Exception e) {
52: e.printStackTrace();
53: }
54: }
55: return jarFileList;
56: }
57:
58: public static void main(String[] args) {
59: new JarFileLookup().parseClasspath();
60: }
61: }
|