Just use "./" .
Regardless of the directory in which your application was run, "./" will always return this directory.
For instance:
new File("./") will return the file object specified in the directory from which your Java application was launched from
new File("./myDirectory") will return the file object specified in the myDirectory folder located in the directory from which the Java application was launched from
source share