Re: class checksums
From: David Zimmerman (foo_at_junk.bar)
Date: 12/12/03
- Next message: Michael Borgwardt: "Re: Override a class in rt.jar"
- Previous message: goose: "Re: lines of code?"
- In reply to: Michael Fairbank: "Re: class checksums"
- Next in thread: Michael Fairbank: "Re: class checksums"
- Reply: Michael Fairbank: "Re: class checksums"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 12 Dec 2003 12:23:01 GMT
Michael Fairbank wrote:
>>That's a two-liner.
>>If you have an Object, you can invoke its getClass() method which gives
>>you access via getName() to its class name and a getResourceAsStream()
>
> method
>
>>that will automatically look in the right location. All you need to do is
>>remove the package component from the name.
>
>
> I'm having problems with this. I cannot get the "resource as stream"
> functions to work when the filename ends in ".class". For example, the
> following code prints "null"
>
> String className=obj.getClass().getName();
> className=className+".class";
> InputStream in=ClassLoader.getSystemResourceAsStream(className);
> System.out.println(className+" in="+(in==null?"null":in.toString()));
>
You need to change the '.'s in the classname to '/'s, the file seperator
in resources
- Next message: Michael Borgwardt: "Re: Override a class in rt.jar"
- Previous message: goose: "Re: lines of code?"
- In reply to: Michael Fairbank: "Re: class checksums"
- Next in thread: Michael Fairbank: "Re: class checksums"
- Reply: Michael Fairbank: "Re: class checksums"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|