答案 0 :(得分:1)
虽然您没有确切地询问您想要做什么,但我认为您希望以harness
中的文件以编程方式打开文件。您可以使用以下方法以编程方式“导航”:
File currentDir = new File("."); //this will be your current directory
File parentDir = currentDir.getParentFile(); //this is parent directory
File newFile = new File(parentDir,"Example.txt"); //this is file Example.txt placed in parent directory
File newFile = new File(parentDir,"bif/Example.txt"); //this is file Example.txt placed in parent directory's directory bif.
答案 1 :(得分:-1)
使用filename.getAbsoulutePath()
您可以找到示例here