0

是否可以在 Windows 7 环境中在您的 java deployment.properties 文件中执行以下操作:

deployment.user.security.trusted.certs=H\:\\hiddendir\\trusted.certs

但是当它创建 hiddendir 目录是隐藏的

例如,在 Linux 上,您可以在 H:\.hiddendir 前面放一个点

Windows 7上有类似的东西吗

4

1 回答 1

1

假设您在本机环境中严格使用它,您可以将属性与 Runtime.exec() 方法一起使用。Java API 中没有任何东西可以单独使用。

一个例子:

Process p = Runtime.getRuntime().exec("attrib +h " + src.getPath());

你可以参考属性

但是,如果您不了解本机环境,则可以创建操作系统检查以提供不同的隐藏文件属性。

IE。

private static String OS = System.getProperty("os.name").toLowerCase();

public static boolean isWindows() {
    return (OS.indexOf("win") >= 0);
}

public static void main(String[] args) {
    if isWindows(){
      //then do
    }
}
于 2015-04-16T16:33:31.643 回答