How do I get user's login name in Java without using any JNI stuff?
I found one example here:
http://javaalmanac.com/egs/javax.sec.../GetLogin.html
but the code won't compile because it choked up on this line:
and I have no idea how to fix it. Can someone offer me some help?Code:Principal principals[] = (Principal[])subject.getPrincipals().toArray(new Principal[0]);
below is what I imported for the little program:
thanks!!Code:import javax.security.auth.login.LoginContext; import javax.security.auth.Subject;


Reply With Quote


Bookmarks