title: Best way to process command line file path argument in Java
body: <p>I'd like to pass a file path argument to my application in a relative form, e.g <code>~/test.conf</code> or <code>../test.conf</code>, but i can't get a proper full file path, though i've tried it with old <code>java.io</code> and new <code>java.nio Files/Paths</code>. Is there a general way to get a resolved file path without large amount of code? It would be fine for the solution to work only in unix envs like OsX or Debian.</p>
  
  <p><strong>Update</strong></p>
  
  <p>With a provided argument like <code>~/test.conf</code>
  in case of <code>getAbsolutePath</code> it returns a path with a prefixed current folder - <code>/Users/currentUser/Projects/Personal/TestProject/~/text.conf</code>. Canonical path returns the same.</p>