Search code examples
intellij-idea

What is a working directory in Intellij IDEA


I created a Maven project and imported it in Intellij IDEA.

In a run configuration, there is a field "working directory", which points to the root of Maven project.

If I change this folder, it doesn't seem to affect anything. So what is it?


Solution

  • This is the directory that is set as the Java user.dir system property. If you have any code that creates relative files or directories, it will be relative to this directory. So for a well designed application (i.e. resolves resources from the classpath and is configurable for output directories) this will not be a factor. There is also some importance to this value in maven projects, especially multi-module maven projects. This directory specifies the directory IDEA will read the POM from.

    If you are unflamilar with what the Java user.dir is, there is some discussion available here and in the class level Javadoc for the File class.