Я пытаюсь создать некоторые файлы динамически в моем корневом проекте Java. но я получаю следующую ошибку при запуске кода.java.io.FileNotFoundException: (Access is denied)
java.io.FileNotFoundException: D:\POS_ALL\T_POS_NEWEST\TouchPosApplication\WebContent\zharaimages\279 (Access is denied)
Возможно ли записать файл в корневую папку проекта на Java? Вот код, который используется.
private void createImage(PosItemImageDTO imageDTO,String path) throws IOException {
byte[] bytes = imageDTO.getPosItemImage();
path = path + "\\";
if(bytes!=null && bytes.length>0){
OutputStream out = null;
// BufferedImage img = ImageIO.read(new ByteArrayInputStream(bytes));
File l = new File(path);
out = new BufferedOutputStream(new FileOutputStream(path));
out.write(bytes);
if (out != null) {
out.close();
}
}
}
Какой процесс пытается создать файл? Кот? –
Попробуйте написать файл самостоятельно в этой папке. – Makky
Это java-процесс, который пытается создать папку и файлы. –