If I get your problem right, you could do something like this:
File a = new File("/some/abs/path");
File parentFolder = new File(a.getParent());
File b = new File(parentFolder, "../some/relative/path");
String absolute = b.getCanonicalPath(); // may throw IOException
More Related Contents:
- How to get the path of a running JAR file?
- Android – Get real path of a .txt file selected from the file explorer
- javac is not recognized as an internal or external command, operable program or batch file [closed]
- How to get a path to a resource in a Java JAR file
- How to construct a relative path in Java from two absolute paths (or URLs)?
- How to add native library to “java.library.path” with Eclipse launch (instead of overriding it)
- How to combine paths in Java?
- How to update PATH variable permanently from Windows command line?
- Java: Path vs File
- Create whole path automatically when writing to a new file
- How to locate the Path of the current project directory in Java (IDE)?
- Setting up enviromental variables in Windows 10 to use java and javac
- Setting up Eclipse with JRE Path
- Get location of JAR file
- How to get current working directory in Java?
- Ant path style patterns
- How to use Selenium WebDriver on local webpage (on my PC) instead of one located somewhere online?
- Loading a file relative to the executing jar file
- Getting directory path to .class file containing main
- Read file from /src/main/resources/
- Setting up enviroment variables in Windows 10 to use java and javac
- Setting the correct PATH for Eclipse
- How can I set the PATH variable for javac so I can manually compile my .java works?
- Determining whether a number is prime or not in Java using for loops
- Why is it considered a bad practice to omit curly braces? [closed]
- Directory creation not working in Marshmallow Android
- Choosing the best concurrency list in Java [closed]
- Understanding java.util.Calendar WEEK_OF_YEAR [duplicate]
- Making a very large Java array
- How to fluently build JSON in Java? [closed]