如何使用java Appliation在cacls中更改用户,而不使用语法上的类型

如何使用java Appliation在cacls中更改用户,而不使用语法上的类型,java,file-permissions,cacls,Java,File Permissions,Cacls,我想问你。我已经在我的项目文件中尝试了这些语法,它很有效。 但是,我想把这些程序改得更强大 下面是我的语法: public class Main { public static void main(String[] args) throws InterruptedException, IOException { frame f = new frame(); f.show(); File f = new File("D:/lala/coba"); //Sy

我想问你。我已经在我的项目文件中尝试了这些语法,它很有效。 但是,我想把这些程序改得更强大

下面是我的语法:

public class Main {

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

    frame f = new frame();
    f.show();


    File f = new File("D:/lala/coba");

    //System.out.println("insert the username:");
   // hide(f);
}

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

如果我想在不写语法的情况下更改用户“DINA”,我应该怎么做?

像这样调用java应用程序 爪哇主斯科特酒店

使用以下代码,用户将是scott

public class Main {

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

    frame f = new frame();
    f.show();


    File f = new File("D:/lala/coba");

    //System.out.println("insert the username:");
   hide(f, args[0]);
}

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

谢谢你,伙计。我试试看。如果我再发现问题,你还会帮我吗?当然!如果我不帮助你,这里总有比我更好的人愿意帮助你:好吧,我已经试过你的sugest语法了,但是我把字符串user和args[0]搞混了。你能告诉我吗?现在你已经知道你把你的java应用程序称为“java”