rohanawaw Posted September 7, 2018 Posted September 7, 2018 in jsp String strPath = "/home1/rajesha1/file.txt"; File strFile = new File(strPath); boolean fileCreated = strFile.createNewFile(); //File appending Writer objWriter = new BufferedWriter(new FileWriter(strFile)); java.io.FileNotFoundException: /home1/rajesha1/file.txt (Permission denied)
wolstech Posted September 7, 2018 Posted September 7, 2018 Tomcat runs as a different user. Try creating a folder inside your home folder, granting it 757 for its permissions (instead of the default 755), then saving the file inside the new folder. The folders where your Java app saves its data needs "other" write permissions, since Tomcat is not running as you and is not in the same group.
rohanawaw Posted September 7, 2018 Author Posted September 7, 2018 i created a folder file1 in home directory butString strPath = "/file1/testoutputaws.txt"; now gives java.io.IOException: No such file or directory
rohanawaw Posted September 7, 2018 Author Posted September 7, 2018 problem solved with permission and path /home1/rajesha1/file1/gg.txt
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now