ERLEDIGT
JA
JA
ANTWORTEN
3
3
ZUGRIFFE
356
356
EMPFEHLEN
-
Hallo,
gibt es in Java eine Möglichkeit die Klassenliste aller verfügbaren Klassen des API
auszulesen mit vollständigen Pfad (also java.lang.String) z.B.? Oder kennt
jemand eine Bibliothek mit der man des vielleicht realisieren koennte?
Danke und Gruß
RedWing"I'm not deaf, I'm ignoring you"
----
-
04.01.06 13:16 #2
- Registriert seit
- Jun 2002
- Ort
- Saarbrücken (Saarland)
- Beiträge
- 9.886
- Blog-Einträge
- 29
Hallo!
Schau mal hier:
Code :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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
/** * */ package de.tutorials; import java.io.File; import java.io.IOException; import java.util.Enumeration; import java.util.jar.JarFile; import java.util.zip.ZipEntry; /** * @author daritho * */ public class SimpleAPIClassPrinter { /** * @param args */ public static void main(String[] args) { String bootClasspath = System.getProperty("sun.boot.class.path"); String[] bootClasspathEntries = bootClasspath.split(System.getProperty("path.separator")); for (int i = 0; i < bootClasspathEntries.length; i++) { String fileName = bootClasspathEntries[i]; if (!fileName.endsWith(".jar")) { System.out.println("Skipping: (NO JAR) " + fileName); continue; } try { File file = new File(fileName); if (!file.exists()) { System.out.println("Skipping: (NOT FOUND)" + fileName); continue; } JarFile jarFile = new JarFile(file); printAllClassesOf(jarFile); } catch (IOException e) { e.printStackTrace(); } } } private static void printAllClassesOf(JarFile jarFile) { System.out.println("Classes for: " + jarFile.getName()); Enumeration entries = jarFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); String entryName = entry.getName(); if (entryName.endsWith(".class")) { System.out.println(entryName); } } } }
Gruss TomJava rocks!
How to become a good Java Programmer?
Does IT in Java and .Net
The only valid measurement of code quality: WTFs / minute
Blog
Xing
Twitter
-
Ahja Danke Tom das ist genau das was ich gesucht habe...
String[] bootClasspathEntries = bootClasspath.split(";");
ersetzt durch
String[] bootClasspathJars = bootClasspath.split(System.getProperty("path.separator"));
dann funktionierts auch bei mir
Danke und Gruß
RedWing"I'm not deaf, I'm ignoring you"
----
-
04.01.06 13:33 #4
- Registriert seit
- Jun 2002
- Ort
- Saarbrücken (Saarland)
- Beiträge
- 9.886
- Blog-Einträge
- 29
Okay, Done.
Btw. in Eclipse gibts eine Perspektive namens "Java Browsing" mit der kann man viel komfortabler durch die Bibliotheken Browsen
Gruss TomJava rocks!
How to become a good Java Programmer?
Does IT in Java and .Net
The only valid measurement of code quality: WTFs / minute
Blog
Xing
Twitter
Ähnliche Themen
-
RSS auslesen
Von h4dhunTer im Forum Delphi, Kylix, PascalAntworten: 2Letzter Beitrag: 22.10.09, 17:30 -
Url ID auslesen
Von PC Freak im Forum PHPAntworten: 1Letzter Beitrag: 24.01.09, 08:34 -
Pfad von J2SDK herausfinden
Von Hawkings im Forum Linux & UnixAntworten: 4Letzter Beitrag: 30.04.08, 16:09 -
url Auslesen
Von schecker im Forum PHPAntworten: 2Letzter Beitrag: 13.12.05, 10:42 -
Alle Neuerungen von J2SDK 1.5 auf einen Blick
Von Thomas Darimont im Forum JavaAntworten: 3Letzter Beitrag: 10.04.04, 16:23





Zitieren

Login





