Topic: [请教]简单IO问题?

  Print this page

1.[请教]简单IO问题? Copy to clipboard
Posted by: popov
Posted on: 2005-01-28 09:00

byte[] bytes = {1, 2};
String filename = "\\\\PCName\\d$\\test.txt";
FileOutputStream out = new FileOutputStream(filename);
out.write(bytes, 0, bytes.length);
out.close();
当filename为网络驱动路径的时候,以上代码用JDK在命令行执行的时候,没有问题,可以在PCName上创建文件;可是当这段代码放到servlet里面用JRun跑的时候FileOutputStream out = new FileOutputStream(filename);就会发生FileNotFoundException,message是拒绝访问。
请各位高手指教?谢谢!

2.Re:[请教]简单IO问题? [Re: popov] Copy to clipboard
Posted by: jsmile
Posted on: 2005-01-28 22:59

Try to map the network drive first, such as mapping "\\\\PCName\\d$" to "Z:". It should work.

3.Re:[请教]简单IO问题? [Re: jsmile] Copy to clipboard
Posted by: popov
Posted on: 2005-01-29 16:36

呵呵,我已经试过了,不过不好使,还是不好用。thank you all the same!Waiting for more help

4.Re:[请教]简单IO问题? [Re: popov] Copy to clipboard
Posted by: Theface
Posted on: 2005-02-18 20:20

\\\\PCName\\d$\\test.txt
不会解析出错吗?

5.Re:[请教]简单IO问题? [Re: popov] Copy to clipboard
Posted by: rostone
Posted on: 2005-02-20 22:13

is it a security problem of servlet?

6.Re:[请教]简单IO问题? [Re: popov] Copy to clipboard
Posted by: anticlockwise_6
Posted on: 2005-02-26 10:36

Is PCName your context root?
Use the absolute path instead of the one you're using, it might work


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923