Версия для печати
Нажмите сюда для просмотра этой темы в оригинальном формате |
Форум на Исходниках.RU > Java > Проблема при конвертации File в Path. Путь правильный |
Автор: Miron 31.03.18, 12:49 |
сама функция: static String GetCreationTime(File f) throws IOException, ParseException{ BasicFileAttributes date = Files.readAttributes(f.toPath(), BasicFileAttributes.class); return date.creationTime().toString(); } Выдает ошибку на этой строчке: BasicFileAttributes date = Files.readAttributes(f.toPath(), BasicFileAttributes.class); Exception in thread "main" java.nio.file.NoSuchFileException: C:\test\test\folder0\folder0\folder0\folder1\folder0 at sun.nio.fs.WindowsException.translateToIOException(Unknown Source) at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) at sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(Unknown Source) at sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(Unknown Source) at sun.nio.fs.WindowsFileSystemProvider.readAttributes(Unknown Source) at java.nio.file.Files.readAttributes(Unknown Source) at Main.GetCreationTime(Main.java:185) Повторяю , путь f правильный! |
Автор: MIF 31.03.18, 19:50 |
COMODO (а мож, и другие антивирусы) умеет искажать адрес файла. Попробуй отключить антивирус. |
Автор: korvin 01.04.18, 19:08 |
Открой командную строку, вставь туда <{CODE_COLLAPSE_OFF}><{CODE_WRAP_OFF}> dir C:\test\test\folder0\folder0\folder0\folder1\folder0 что пишет? |