Use MyClass.class.getName() /Suresh
> -----Original Message----- > From: A mailing list for discussion about Sun Microsystem's Java Servlet > API Technology. [mailto:[EMAIL PROTECTED] Behalf Of > Michael Weller > Sent: Thursday, July 15, 2004 5:17 PM > To: [EMAIL PROTECTED] > Subject: Re: WhoAmI > > > [EMAIL PROTECTED] wrote: > > >How can a class discover in a static context what fully > qualified name is its own? > > > >package unknown; > >class WhoAmI{ > >private static final className = ...????; > >} > > > >I can't use, of course, this.getClass().getName(). > > > > > What about 'String myName = new > Exception().getStackTrace()[0].getClassName();'? > > -mw > > __________________________________________________________________ > _________ > To unsubscribe, send email to [EMAIL PROTECTED] and include > in the body > of the message "signoff SERVLET-INTEREST". > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > Resources: http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html > ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html