create hidden Folder in java code -


this question has answer here:

i want create hidden folder in java code. use code:

   `      public static void main(string[] args) throws exception     {          file f=new file(system.getproperty("user.home")+"desktop/file");         f.mkdir();         string cmd="attrib +h "+f.getabsolutepath();          runtime.getruntime().exec(cmd);  } 

`

but error is:

    `   exception in thread "main" java.io.ioexception: cannot run program "attrib": error=2, no such file or directory     @ java.lang.processbuilder.start(processbuilder.java:1042)     @ java.lang.runtime.exec(runtime.java:615)     @ java.lang.runtime.exec(runtime.java:448)     @ java.lang.runtime.exec(runtime.java:345)     @ filespermssion.testruntime.main(testruntime.java:22) caused by: java.io.ioexception: error=2, no such file or directory     @ java.lang.unixprocess.forkandexec(native method)     @ java.lang.unixprocess.<init>(unixprocess.java:135)     @ java.lang.processimpl.start(processimpl.java:130)     @ java.lang.processbuilder.start(processbuilder.java:1023)     ... 4 more java result: 1` 

can me

there missing / before desktop, resulting in 2 directories mkdir cannot (mkdirs have).

file f=new file(system.getproperty("user.home")+"/desktop/file"); 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -