Reputation: 13
i have a plugin which is going to be used more than one client, and the plugin has to access a file to load some arrays in java
fFile = new File("file path");
I want the path is general,
How can I declare a file path for more than one account? For example
" C:\users\X\documents\filename" and for another user
" C:\users\Y\documents\filename" or maybe something "C:\users\$username\documents\filename"
Upvotes: 0
Views: 560
Reputation: 38168
You can use System.getProperty( "user.home" )
to get the home directory of users.
And use that String to compose your path.
Regards, Stéphane
Upvotes: 1
Reputation: 72294
System.getProperty("user.home");
is what you want here - usually it returns the my documents folder on windows and /usr/home on *nix.
Upvotes: 1
Reputation: 240918
use user.home
for this
String path = System.getProperty("user.home") + File.separator + "someFileName.txt";
Upvotes: 3