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. Aug 8, 2012 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. Aug 9, 2012 at 1:51
  • It looks like in general the problem can be avoided by using something like platformdirs Mar 8 at 16:22

2 Answers 2


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.

  • 2
    I especially support the advice about ~/.config/MyApp rather than ~/.MyApp. Mar 20, 2017 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

  • 1
    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, 2015 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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