how to input the path name of folder/file and username/hostname in cacls

227 Views Asked by At

i have tried these following syntax:

public class Main {
private static String isi;

public static void main(String[] args) throws InterruptedException, IOException {

   String host = "";
   String dir = "" ;


    Scanner inputScanner = new Scanner(System.in);
    System.out.println("insert the path of folder or file:" );
    dir = inputScanner.next();
    File f = new File(dir);
  //  dir = isi;


    System.out.println("insert the username:"  );
    host = inputScanner.next();

    System.out.println();
    System.out.println();
    System.out.println(f);
    System.out.println(host);

    perm(f, host);
}

public static  void perm(File src, String user) throws InterruptedException, IOException {
    // win32 command line variant
    Process p = Runtime.getRuntime().exec("cacls " + src.getPath() + " /E /C /P " + user + ":n");
    p.waitFor(); }   }

but, the object "f" and parameter host didn't called by void perm. why it's happen?

i need your help. i'm thankfull for your hel and advice.

0

There are 0 best solutions below