[java] Java "user.dir" property - what exactly does it mean?

I want to use user.dir dir as a base dir for my unit tests (that creates a lot of files). Is it correct that this property points to the current working directory (e.g. set by the 'cd' command)?

This question is related to java

The answer is


System.getProperty("user.dir") fetches the directory or path of the workspace for the current project


Typically this is the directory where your app (java) was started (working dir). "Typically" because it can be changed, eg when you run an app with Runtime.exec(String[] cmdarray, String[] envp, File dir)


user.dir is the "User working directory" according to the Java Tutorial, System Properties