Hi all, I want to retrieve all classes of a package from within a programme (not from a commandline with jar). I have to use JDK 1.1. I searched a lot but I can't find any resources on this. Thanks for help Helmut
You can execute an os command using this syntax: Runtime.getRuntime().exec("cmd /K start run.bat"); or Runtime.getRuntime().exec("notepad.exe"); SOOOO if you run the command and pipe the output into a file to read in later: Runtime.getRuntime().exec("jar -tf whatever.jar > output.txt"); should work (I haven't tested this - sorry).
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Feb 11, 2001
Hi, thanks for answering:
Originally posted by Cindy Glass: SOOOO if you run the command and pipe the output into a file to read in later: Runtime.getRuntime().exec("jar -tf whatever.jar > output.txt");
We can't get this information by using something like the reflection API? Thanks
Joined: Sep 29, 2000
Reflection is something used by objects. A jar file is not an object, it is something created outside of the JVM, so I do not know of any other way to do this.