rohanawaw Posted September 7, 2018 Share 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) Quote Link to comment Share on other sites More sharing options...
wolstech Posted September 7, 2018 Share 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. Quote Link to comment Share on other sites More sharing options...
rohanawaw Posted September 7, 2018 Author Share 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 Quote Link to comment Share on other sites More sharing options...
rohanawaw Posted September 7, 2018 Author Share Posted September 7, 2018 problem solved with permission and path /home1/rajesha1/file1/gg.txt Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.