This content has been marked as final. Show 3 replies
EJP wrote:This also gives me the absolute path and not the relative path.
Ok. i will explain my situation more clearly.
For example, this is my file path
and my java file is running in the directory
In this case,
The absolute path of the a.txt is
and the relative path is
Am i right here?
It gives you the path you constructed it with.
If you want it relative you will have to say what you want it relative to.
There are relativizing methods in java.net.URI, and methods to convert back to File as well.