how to get the complete classpath using java code
hi friends
i am developing an application in which i am using reflection,i have to read a
classpath that jvm generates using reflection ,i usedsystem.property("java.class.path"); but its getting the jar files ,but i need the.class file to be displayed on the classpath ,how to get it .
thanks
> i am using reflection in my application so from the
> classpath i should get class
> files using reflection
I am guessing you have no idea what you are doing.
I can only suppose that you want to span the directories that are in the class path and look for class files.
If so...
1. You get the class path
2. You split it.
3. For each path you look for class files in that directory.
4. For each jar you use the api to open the jar and look for class files in that. You might want to consider that jars can contain jars.
5. For each class file found in 3 and 4 you must parse the class structure to determine the fully qualified file name.
6. You display that list.
Note that it much easy to just require a configuration file that specifies the fully qualified names.