Is it possible for Java application to know the its own current directory. I am referring to result of pwd
.
For instance, when executed
~/Documents/workspace/Project/bin $ java com/foo/bar/baz/Runner files/text1.txt
program should know ~/Documents/workspace/Project/bin
~/Documents/workspace/Project $ java com/foo/bar/baz/Runner files/text1.txt
program should know ~/Documents/workspace/Project
Maybe this helps:
File cwd = new File(".");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With