Ругается: Exception in thread "main" java.io.FileNotFoundException: D:\Miroslav\Work\File1.txt (Синтаксическая ошибка в имени файла, имени папки или метке тома)
При этом я вбиваю путь: D:\Miroslav\Work\File1.txt
Вот скрин пути к файлу:
![]()

package com.javarush.task.task18.task1827;
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
/*
Прайсы
*/
public class Solution {
public static void main(String[] args) throws Exception {
class Product implements Comparable{
private int id;
private String productName;
private String price;
private String quantity;
public Product(int id, String productName, String price, String quantity){
this.id = id;
this.productName = productName;
this.price = price;
this.quantity = quantity;
}
@Override
public int compareTo(Object o) {
Product product = (Product) o;
if (id < product.getId()) {
return 1;
} else {
return -1;
}
}
public int getId() {
return id;
}
public String getProductName() {
return productName;
}
public String getPrice() {
return price;
}
public String getQuantity() {
return quantity;
}
@Override
public String toString() {
String idString = id +"";
String productName = getProductName();
String price = getPrice();
String quantity = getQuantity();
if (idString.length() < 8){
idString += " ";
}
if (productName.length() < 30){
productName += " ";
}
if (price.length() < 8){
price += " ";
}
if (quantity.length() < 4){
quantity += " ";
}
idString = idString.substring(0,8);
productName = productName.substring(0,30);
price = price.substring(0,8);
quantity = quantity.substring(0,4);
return idString + productName + price + quantity;
}
}
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String file = reader.readLine();
BufferedReader fileReader = new BufferedReader(new FileReader(file));
String s;
ArrayList<String> list = new ArrayList<>();
while ((s = fileReader.readLine()) != null){
list.add(s);
}
fileReader.close();
ArrayList<Product> products = new ArrayList<>();
for(String j : list){
int id = Integer.parseInt(j.substring(0, 8).trim());
String productName = j.substring(8, 38);
String price = j.substring(38, 46);
String quantity = j.substring(46);
while (quantity.length() != 4){
quantity += " ";
}
products.add(new Product(id, productName, price, quantity));
}
Collections.sort(products);
int idMax = products.get(0).getId();
if (args.length == 4) {
String command = args[0];
String productName = args[1];
String price = args[2];
String quantity = args[3];
if (command.equals("-c") || command.equals("-с")) {
idMax++;
int id = idMax;
Product product = new Product(id, productName, price, quantity);
FileOutputStream fileOutputStream = new FileOutputStream(file, true);
fileOutputStream.write(("\n" + product).getBytes());
fileOutputStream.close();
}
}
fileReader.close();
reader.close();
}
}