How to open a directory on a networked computer with Java -
i tried this.
string userhomepath = "\\mysvr\\project\\my team\\001 test\\001 test\\003 report"; file userhome = new file(userhomepath); try { desktop.getdesktop().open(userhome); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); }
why can't open? plz explain me. because of white spaces? if so, how can fix it. thanks
here's exception:
java.io.ioexception: failed open file:////mysvr/project/my%20team/001%20test/001%20test/003%20report/. error message: system cannot find file specified. @ sun.awt.windows.wdesktoppeer.shellexecute(unknown source) @ sun.awt.windows.wdesktoppeer.open(unknown source) @ java.awt.desktop.open(unknown source) @ org.ace.insurance.fire.renewal.test.main(test.java:13)
i can open till "\mysvr\project" .
use "//mysvr/project/..."
or "\\\\mysvr\\project\\..."
.
of course first try out in windows explorer. doubling backslash in java string literal.
Comments
Post a Comment