Discussion Locked
0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How do i get all the java packages in the classpath and get all the classes contained in the package at runtime. I need this because i have designed a small class browser and want to add a graphical display of packages in the classpath. The method in the java.lang.Package class doesn't give all the packages in the classpath.
3 replies
by penguinone!
You can get the class path by the following call:
String classPath = System.getProperty("java.class.path");
From there, you tokenize the string based on:
String classPathSeparator = System.getProperty("path.separator");
StringTokenizer tokenizer = new StringTokenizer(classPath, classPathSeparator, false);
Note that this will not only return directories, but also zip and jar files. If you want to display classes in those, check out java.util.zip and java.util.jar.Good luck!
by anz
ok, i did as you told me, it's working, thanks
by anz
This question was closed by the author
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending
0 helpful
1 reply
0 helpful
1 reply
0 helpful
1 reply
1 helpful
3 replies
Question
Windows and macOS computers becoming slow or unstable after updates - what should I check first
0 helpful
1 reply