|
You can determine the application your directory is started in using Java's System.getProperty() method, like this:
package ptest;
public class Main {
public Main() {
}
public static void main(String[] args) {
System.out.println("user.dir: " + System.getProperty("user.dir"));
}
}
When you compile and run this program the output will show you the directory you ran the program in.
Accessing this property is often helpful when you want to store or read configuration, input, or output files that are related to your application.
You can get a full listing of all available properties at this URL.
|