简体   繁体   中英

Create a hidden directory from deployment.properties

Is it possible in a Windows 7 environment to do the following in your java deployment.properties file:

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

but when it creates hiddendir the directory is hidden

eg on Linux you could put a dot in front H:\\.hiddendir

is there anything similar on Windows 7

Assuming that you are using this strictly on a native environment you can use an attribute with the Runtime.exec() method. There is nothing solely in the Java API which could be used.

An example:

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

You can refer to attrib .

However, if you are unaware of the native environment, you can create an OS check to provide different hidden file properties.

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
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM