• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java & System Properties Regarding..

 
Jack Daniel
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all..

well, i have got a question...

with the following code:


It gets the USER account name...
(1) how and from where does java interpreter get this???
(2) Will it be equal to the (say) Windows Log-in name, OR it is got from the System and will not be read from Windows Log on;

just wanted to figure out, because if it is the windows log in name, then at some applications, i can prevent the user from logging and by default use the windows-login name, to identify the user..

Otherwise, Is there a way to read Windows log on name, from java??

it will be great if u guys help me on this..
appreciate your help..
thx ;-)
 
Scott Dunbar
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is retrieved from the underlying O/S. As long as you control the program you should be ok. However, there is nothing from stoping something like:



C:\scott> java Props
user.name is "scottd"

C:\scott>java -Duser.name=blah Props
user.name is "blah"

So be careful with who can change the startup script.
 
Jack Daniel
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks scott..

so you mean to say it is read from the O/S (maybe say from some Registry key).. but it will not be the same as the O/S log in? (which sometimes will be different, say a public system, where different users log in.. )

plz clarify.. thanks again..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic