KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hammurapi > inspectors > metrics > JarFileLookup


1
2 /*
3  * Hammurapi
4  * Automated Java code review system.
5  * Copyright (C) 2004 Johannes Bellert
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  *
21  * URL: http://www.pavelvlasov.com/pv/content/menu.show?id=products.jtaste
22  * e-Mail: Johannes.Bellert@gmail.com
23  */

24
25 package org.hammurapi.inspectors.metrics;
26
27 import java.io.File JavaDoc;
28 import java.util.StringTokenizer JavaDoc;
29 import java.util.Vector JavaDoc;
30
31 /**
32  * @author 111001082
33  *
34
35  */

36 public class JarFileLookup {
37
38
39     public JarFileList parseClasspath() {
40         JarFileList jarFileList = new JarFileList();
41         StringTokenizer JavaDoc tokenizer = new StringTokenizer JavaDoc(System
42                 .getProperty("java.class.path"), System
43                 .getProperty("path.separator"));
44
45         while (tokenizer.hasMoreTokens()) {
46             try {
47                 String JavaDoc jarFileAbsolutePath = tokenizer.nextToken();
48                  File JavaDoc jarFile = new File JavaDoc(jarFileAbsolutePath);
49                  JarFile jf = new JarFile( jarFileAbsolutePath, jarFile.length(), jarFile.lastModified() );
50                  jarFileList.add( jf );
51                // System.out.println ( jf.toString() );
52
} catch (Exception JavaDoc e) {
53                 e.printStackTrace();
54             }
55         }
56         return jarFileList;
57     }
58
59 public static void main(String JavaDoc[] args) {
60         new JarFileLookup().parseClasspath();
61     }}
Popular Tags