System.getProperty () on the server

0

In my code I use the System.getProperty ("user.name") to get the local user name. But I would like to use my application on a server. And by rotating it instead of returning what was previously returned locally, it is returning "root".

I believe that it is returning the "username" of the server, or my own machine but the User Admin. My question is: Is it possible for me to even run the application via System.getProperty ("user.name") to get the user's access to the server?

If you can not by System.getProperty (), do you have any other means?

    
asked by anonymous 29.09.2014 / 20:54

1 answer

2

Documentation

  

The System class holds an object Properties that describes the current desktop configuration. This object is initially populated by the JVM, you can specify additional parameters using the -D property = value

In your case, the JVM set the user as root. To be easy to understand, imagine that System.getProperty ("user.name") is running on the server side, not on your machine.

If you want to get the current user, you can opt for a signed applet or javascript (although I'm not sure if this is a portable way to get this information).

    
29.09.2014 / 23:01