Possible Duplicate:
What is the cross-platform way of obtaining the path to the local application data directory?
I'm looking for a way to get the location of the local application data folder, which is a special Windows folder, in Java. Unfortunately, the following only works for English versions of Windows XP with default settings:
System.getProperty("user.home") + "\\Local Settings\\Application Data"
What I'd like to have is something like this in .NET:
System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
Is there a way to do it without having to call SHGetSpecialFolderLocation of the Windows Shell API?
To open the AppData folder on Windows 10, 8 & 7: Open File Explorer/Windows Explorer. Type %AppData% into the address bar and hit enter. Navigate to the required folder (Roaming or Local)
Select File Explorer Options. Select the View tab of the File Explorer Options window. Choose Show hidden files, folders, and drives > Apply > OK. The AppData folder is located at C:\users\YOURNAME, where YOURNAME is your Windows profile ID.
The application data folder is a special hidden folder that your app can use to store application-specific data, such as configuration files. The application data folder is automatically created when you attempt to create a file in it. Use this folder to store any files that the user shouldn't directly interact with.
System.getenv("APPDATA")
(there seems to be no env variable for the "Local Settings" folder, but this will give you the 'Application Data' folder)
what about the following
String dataFolder = System.getenv("LOCALAPPDATA");
I have a situation where this is NOT under "user.home"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With