3

So I'm using the java System.getProperties("user.home"). Here's the problem I am encountering, I'm calling it in an installation process which required admin rights, and during the installation process I need to save a few files in the user's directory (ex. c:\Users\myname\AppData\Local\SavedFiles). The problem arises as shown in the steps below:

1) User mbrando logs in on windows 8
2) He run's the installer
3) he is prompted to login with admin rights
4) he logs in as user: imadmin
5) installer continues
6) installer saves some files that is local to the user in c:\users\imadmin\AppData...
instead of c:\users\mbrando\AppData

The user's local home directory is obtained by calling the System.getProperties("user.home"). Basically I am wondering id I can get the logged in user's home directory rather than the admin user's. Any ideas how I can get this using the java System.getProperties?

Thanks.

ibaralf
  • 12,218
  • 5
  • 47
  • 69
  • 1
    Windows is a multi-user system. What if some other user runs the application? Consider doing this setup when the application is run first time. Also note the [issues with `user.home` on Windows](http://stackoverflow.com/questions/585534) - it may not point to anything useful. – McDowell Jun 12 '13 at 18:44

1 Answers1

0

The installer is run by "imadmin" actually. not mbrando.

finejustice
  • 413
  • 2
  • 9
  • Yeah, that is what's happening. But is it possible to get the other user's information (such as his home directory or even user name)? – ibaralf Jun 12 '13 at 19:22