Java应用程序是否可以知道其自己的当前目录.我指的是pwd的结果.
例如,执行时
~/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
解决方法
也许这有助于:
File cwd = new File(".");