'Cant input file into mac OS folder, fileNotFoundException

Try to insert file to existing local folder. But seems like there's any security or permission issue

String path = con.getConfigValue("CustomPathImgUpload"); //return /Users/name/Documents/
File file = new File(path + date + "_" + fileName);

Got error below

java.io.FileNotFoundException: /Users/name/Documents/20221010_abc.xlsx (No such file or directory) at java.base/java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:211)

Check users folder , system read write check name folder , name read write check documetns folder, name read write

Eclipse apps and chrome apps already get full disk access

Get this problem after update from OS bigsur to menterey

How to solve this issue?

EDIT

Try to change the path to /Users/ and /Applications/ still folder location not found.

Make sure it's not source code mistakes by run it in windows eclipse. File saved correctly

ada usr/bin/java , jawaw, javap, etc to full disk access still not work

EDIT 2

try to use System.getProperty("user.home") + File.seperator + date + filename return "/Users/name/20221010_abc.xlsx" But still get no such directory :'(

Is it because my Users folder permission looks like this?

enter image description here

OR is there any way to check what path is exist ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source