Can Java source code know it's parent file and package names without explicitly defining static String's?
Posted on 2006-06-20
I'm beginning to use JBuilder 2005 for servlet programming.
I often embed references to the source filename (and associated package it belongs to) when reporting error exceptions. Currently, I have private static String vars named -- appropriately -- CLASS_NAME and PACKAGE_NAME.
Is there a better way? I was wondering if there was some magical code call that automatically identifies their names. If not a JDK call, but perhaps a JBuilder macro-like call that can be embedded in my .java files (for example -- and I'm making this up -- #CLASSNAME#.)