Na verdade não consegui entender que tipo de aplicação você está usando, se é um servlet/JSP (a), se é uma aplicação Java normal (b), ou se é um applet ©.
No caso (b) System.getProperty(“user.name”) retorna o nome do usuário logado.
No caso © é a mesma coisa, só que você precisa assinar o applet, senão você vai obter uma exception de segurança.
No caso (a) a solução genérica é chamar o método getRemoteUser() do objeto request (veja o javadoc de javax.servlet.http.HttpServletRequest). O problema é que você tem de configurar direitinho o seu web server - e isso obviamente depende se você tem um Tomcat, Apache, iWS, Websphere etc.
[i]
String getRemoteUser ()
Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.
Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Same as the value of the CGI variable REMOTE_USER.
Returns:
a String specifying the login of the user making this request, or null if the user login is not known
[/i]
Dê uma olhada neste artigo também.