I have to create a new CSV file and write data to that file. Here's my code snippet
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), ',');
But when I'm trying to execute the above code, I'm getting the below error
java.io.IOException: The system cannot find the path specified
The location where I want to create my new csv file is
javaPath+File.separator+tempFolderPath+File.separator+dto.getFileName()+".csv"
Which evaluates to
D:/cradius-data-local/files/webapps/vcm\ocr_zips\AMIT_COOL_123\AMIT_COOL_123.csv