I want to get class which is located in jar (eg i will give input as java.util.Date ), as inputstream.i have tried using getResourceASStream but this is returning null so can any one help in resolving this issue.
Presumably, this relates to the Original Poster's earlier questions, where he wanted to find out all classes used by a particular class. Doing that involves reading the class file.
One pit-fall in trying to read classes from Jars is that the name needs to use slashes, not dots, as package delimiters. So "java.lang.String" is "java/lang/String" in the Jar.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Joined: Oct 17, 2006
here i am checking for class file to be exsited in particular path if file dont exists at that location it raises exception which sets flag if flag is set than i am trying to read that file from java packages of jars
Can you show us where you define "clsname". Also, as the previous poster mentioned, you need to convert the "." characters to "/" characters, and add a leading "/" character.
And another to remember that, that complicates all of this, are internal classes, anonymous and otherwise, that will appear with a "$" character in the name of the class file, so the class file name will not exactly match the name of the class, if it even has one. So if you run into a class that contains internal classes and you wish to "cycle through" these classes as well, you may wind up having some real fun attempting to paste together the name of the class file.
Also, I don't believe the problem you are having here is really one for the Advanced forum. But, if the moderators agree with me, this thread will probably be moved to the Intermediate forum anyway. [ January 12, 2007: Message edited by: Martin Simons ] [ January 12, 2007: Message edited by: Martin Simons ]
subject: how to get class in the jar as inputstream