I'm creating a project that I want to be able to distribute across platforms. I'm writing in Java and AWT which already gives me a pretty large range of devices, but I'm mostly interested in Windows and Linux (Debian/Ubuntu).

I'm trying to determine where I should put config files. I have application-wide configuration files and user-specific files. Where are common directories to put these files?

Here's my current setup:


App Config: %PROGRAMDATA%\MyApp\config\

User Config: %USERPROFILE%\AppData\Local\MyApp\


App Config: /opt/MyApp/config

User Config: $HOME/.MyApp/

  • 4
    Sounds good to me. – Robert Harvey Aug 8 '12 at 23:18
  • 3
    If you're going to use environment variables to construct paths, at least use %LOCALAPPDATA%. There's nothing that guarantees that the path you constructed there from the user profile actually points out the local appdata. If you've got Win32 bindings, prefer Known Folders. – Lars Viklund Aug 9 '12 at 1:51

This sounds OK, it's pretty much what most software does. But in Linux, you might want to put the app configuration files in /etc (or under a subdirectory, e.g. /etc/myapp) as it's more fitting to the FHS:

/etc Host-specific system-wide configuration files

Also, you might want to put user configuration in ~/.config/MyApp rather than ~/.MyApp. This helps reduce clutter in the user's home directory.

| improve this answer | |
  • 2
    I especially support the advice about ~/.config/MyApp rather than ~/.MyApp. – mircealungu Mar 20 '17 at 10:37

I'm no expert, but in my experience, Linux puts some default (non-editable) config files in /etc/your-app-here, whereas user-editable config files these days go in ~/.config/your-app-here (that is $HOME/.config/your-app-here)

Reference link

| improve this answer | |
  • files under /etc/ are of course editable, and are edited to configure system-wide behaviour; however, you need special permissions (e.g. by being root) to make these changes. – umläute Feb 10 '15 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.