title: How to provide relative path in File class to upload any file?
body: <p>I am uploading a file, for which I want to provide a relative path, because the program should work in both linux and windows env. </p>
  
  <p>This is what I am using to upload</p>
  
  <pre><code>realPath = getServletContext().getRealPath(/files);
  destinationDir = new File(realPath);
  if(!item.isFormField())
                  {
                      File file = new File(destinationDir,item.getName());
  
                      item.write(file);
  }
  </code></pre>
  
  <p>Any other means to directly provide relative path here<br/> </p>
  
  <pre><code>File file = new File(destinationDir,item.getName());
  </code></pre>