get absolute path of a file which is outside workspace in java

Although you didn’t ask certainly what you want to do, I assume that you want to open a file programmatically from a file which is in harness. You can ‘navigate’ programmatically using the following methods:

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.

Leave a Comment