Get relative path of a File path? [duplicate]
问题 This question already has answers here : How to construct a relative path in Java from two absolute paths (or URLs)? (22 answers) Closed 3 years ago . I need to get the relative file path (relative to the program executable path) from a File object. What's the best way to do this? File offers only methods for the absolute path. Maybe getting execution path manually and then cut this path off from the absolute path to get a relative path? I am on Java 7, just in case java.nio has some helping