title: How to validate a file path in java?
body: <p>I'm writing a Java program that reads some input from the user which should be a relative path to a predefined folder. For example he will enter test/subfolder and i will generate <code>/path/to/test/subfolder</code>.</p>
  
  <p>How can i check for and prevent the user from entering something like <code>../../../</code> that will mess up the path and allow him to access path that it's not allowed to?</p>