Can a java program know its current directory?
•
Java
Can a Java application know its own current directory I am referring to the results of PWD
For example, when executing
~/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
Solution
Perhaps this helps:
File cwd = new File(".");
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码