Since you mentioned PHP, I will take the web context. Using the Servlet API, you can get the real path corresponding to the relative path using servletContext.getRealPath(relativePath)
Outside of the web context, you can use file.getAbsolutePath() , where file is java.io.File built with a relative path.
Bozho
source share