Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 2 of 2
Should the first step fail, try locating the class definition as a classloader resource with a .class extension. Java specifications do not detail whether this is allowed: arbitrary code with the ability to read entire class
definitions via URLs is a potential security hole, and some JVMs forbid getResource() for *.class resources. However, Sun Microsystems' JDK implementation uses this approach for normal classloading, and that seems to convey
some measure of legality on it.
Finally, don't forget that you can't find something that doesn't exist: a java.lang.Class object in a JVM does not need to be backed by a real .class file anywhere. An obvious example here is a dynamic proxy class: its byte-code definition is synthesized at runtime, and
getClassLocation() returns null for such a class. Most likely, future J2SE versions will rely even more on runtime class construction. For that
and classloader-related reasons, you should use the method I've shown only for testing and debugging.
Archived Discussions (Read only)