Hello.
The workaround is to create an object of that class:
package tmp;
class WhoAmI
{
private static String className;
public static void accion ()
{
className = new WhoAmI ().getClass().getName();
System.out.println (className);
}
public static void main (String args[])
{
accion ();
}
}
Good bye.
>From: "sergiodegioia@(protected)>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology." <SERVLET-INTEREST@(protected)>
>To: SERVLET-INTEREST@(protected)
>Subject: WhoAmI
>Date: Tue, 13 Jul 2004 19:01:00 +0200
>
>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().
>
>Tnx for ur replay
>
>___________________________________________________________________________
>To unsubscribe, send email to listserv@(protected)
>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
_________________________________________________________________
Charla con tus amigos en l�nea mediante MSN Messenger:
http://messenger.latam.msn.com/
___________________________________________________________________________
To unsubscribe, send email to listserv@(protected)
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