Access File in Mac using java.io.file -


i using java.io.file create new file in java.on mac-os using same code working fine on windows not working on mac.

i using

file file = new file(path); 

to create new file.

in windows: used string path = "c:\test\1.html"; working fine.

on mac: want create file @ "/users/pls/1.html" throwing error

java.io.filenotfoundexception : /users/pls/1.html (no such file or directory) 

please help

don't write separators manually,use system independent file.separator instead.

string path = file.separator+"users"+file.separator+"pls"+file.separator+"1.html"; file file = new file(path); 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -