title: Create a new CSV file using Java
body: <p>I have to create a new CSV file and write data to that file. Here's my code snippet</p>
  
  <pre><code>String path = "D:\\cradius-data-local\\files\\webapps\\vcm";
  String javaPath = path.replace("\\", "/");
  String tempFolderPath = "zips"+File.separator+dto.getFileName();
  File csvFile = null;
  CSVWriter csvWriter = null;
  csvFile = new File(javaPath+File.separator+tempFolderPath+File.separator+dto.getFileName()+".csv");
  if(!csvFile.getParentFile().exists()){
      csvFile.getParentFile().mkdirs();
  }
  csvWriter = new CSVWriter(new FileWriter(csvFile), ',');
  </code></pre>
  
  <p>But when I'm trying to execute the above code, I'm getting the below error</p>
  
  <pre><code>java.io.IOException: The system cannot find the path specified
  </code></pre>
  
  <p>The location where I want to create my new csv file is </p>
  
  <pre><code>javaPath+File.separator+tempFolderPath+File.separator+dto.getFileName()+".csv"
  </code></pre>
  
  <p>Which evaluates to </p>
  
  <pre><code>D:/cradius-data-local/files/webapps/vcm\ocr_zips\AMIT_COOL_123\AMIT_COOL_123.csv
  </code></pre>