0

When on my Linux machine using tomcat for a java web application and I run an application from tomcat, the server did not able to create a folder inside another folder in my home like home/manusingh/webbee/ through the application.

I was writing a command on terminal like-

[root@localhost manusingh]# chmod -R 755 webbee2 [root@localhost manusingh]# chown -R nobody.nobody webbee2

netsuiteCredentials.HOME_PATH=/home/manusingh/webbee2/

//java code trying to create file on machine

File hmsFolder =new File(netsuiteCredentials.HOME_PATH+"HMS"); if(!hmsFolder.exists()) {

            System.out.println("hms folder not exists");
            hmsFolder.mkdirs();
        }

        File credentialsFolder =new File(netsuiteCredentials.HOME_PATH+"credentials");
        if(!credentialsFolder.exists()) {
            System.out.println("credential folder not exists");
            credentialsFolder.mkdirs();
        }
Manu Singh
  • 39
  • 4

1 Answers1

0

Yes it is happening because you don't have permission for that directory.

Run below command to give permission for any directory.

sudo chmod 777 -R /folderPath

Refer this : How do I change permissions for a folder and all of its subfolders and files in one step in Linux?

Alien
  • 15,141
  • 6
  • 37
  • 57
  • I want to do this with my java application. Is there any way to do this successfully in java? – Manu Singh Feb 22 '19 at 12:34
  • done the file permission issue. But the problem is with google drive authentication file i.e. created with the help of scribe library. I have no command over this file. – Manu Singh Feb 26 '19 at 06:02