Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/

share|improve this question
Sounds good to me. – Robert Harvey Aug 8 '12 at 23:18
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
up vote 5 down vote accepted

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.

share|improve this answer

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

share|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 posting your answer, you agree to the privacy policy and terms of service.

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