Results 1 to 5 of 5
Thread: Problem on mkdir
- 03-25-2011, 02:43 PM #1
Member
- Join Date
- Sep 2010
- Posts
- 29
- Rep Power
- 0
Problem on mkdir
Hello i create a jar file (netbeans) to create a program.
When i write this code:
is not working, no folder created!Java Code:File folder = new File("C:/Program Files/test/files"); folder.mkdir();
Windows XP.
when i edit the above code for Linux it works like a harm but on windows no :\
Thank you
- 03-25-2011, 03:02 PM #2
Senior Member
- Join Date
- Dec 2008
- Location
- Kolkata
- Posts
- 280
- Rep Power
- 5
Do you already have test under Program Files?
Swastik
- 03-25-2011, 03:09 PM #3
Member
- Join Date
- Sep 2010
- Posts
- 29
- Rep Power
- 0
No but i try and this
with the same result.Java Code:File folder = new File("C:/Program Files/test"); folder.mkdir();
- 03-25-2011, 03:13 PM #4
Member
- Join Date
- Nov 2010
- Posts
- 44
- Rep Power
- 0
Well if the "test" directory, under which you are trying to create the "files" directory doesn't exist, than mkdir() won't work, you need to use mkdirs() which will create the entire directory structure.
lets say you wanted: c:\home\jacl\scripts\ws
but neither jacl, nor scripts folder along with ws existed under home, than using mkdirs() will create those directories for you, whereas if those directories don't exist and you use mkdir() it won't work.
Hope this helps
- 03-25-2011, 03:18 PM #5
Member
- Join Date
- Sep 2010
- Posts
- 29
- Rep Power
- 0


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks