title: Is there a way in Java to determine if a path is valid without attempting to create a file?
body: <p>I need to determine if a user-supplied string is a valid file path (i.e., if <code>createNewFile()</code> will succeed or throw an Exception) but I don't want to bloat the file system with useless files, created just for validation purposes.</p>
  
  <p>Is there a way to determine if the string I have is a valid file path without attempting to create the file?</p>
  
  <p>I know the definition of "valid file path" varies depending on the OS, but I was wondering if there was any quick way of accepting <code>C:/foo</code> or <code>/foo</code> and rejecting <code>banana</code>.</p>
  
  <p>A possible approach may be attempting to create the file and eventually deleting it if the creation succeeded, but I hope there is a more elegant way of achieving the same result.</p>