0

I'm trying to open a file from Java in Ubuntu using FileInputStream.Now my problem is,how can i find the path of the current user as /home/"currentuser"/myfile.xxx?? Normally i use the path as a string since i know the current user. Regards.

4

1 に答える 1

4

The user's home directory can be retrieved via

String userHomeDir = System.getProperty("user.home");

See System Properties

于 2012-04-16T06:05:09.853 に答える