This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Java in General and the fly likes java & System Properties Regarding.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java & System Properties Regarding.. " Watch "java & System Properties Regarding.. " New topic

java & System Properties Regarding..

Jack Daniel
Ranch Hand

Joined: Jun 15, 2002
Posts: 163
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

Joined: Sep 23, 2004
Posts: 245
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 is "scottd"

C:\scott>java Props is "blah"

So be careful with who can change the startup script.

<a href="" target="_blank" rel="nofollow">Java forums using Java software</a> - Come and help get them started.
Jack Daniel
Ranch Hand

Joined: Jun 15, 2002
Posts: 163
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..
I agree. Here's the link:
subject: java & System Properties Regarding..
It's not a secret anymore!