开发者

java windows file creation

i am checking the text file which is prese开发者_运维技巧nt in the mapped hard drive or not.

 File cfile = new File("R:\\Link Fixer Reports\\ServiceTest.txt");

but it shows that file is not present when use c:\\t.txt it shows the file

what is the problem and how can i rectify the problem?


It's likely that the user that your code is running as can't see the mapped directory.

You've tagged this question as java-ee so I'd guess that this code is running within a web service or similar? What user is your application server running as? Verify that this user can access the location. As @Christian pointed out, a UNC-Path is a better way to go - just make sure that you can access the network location. Try runas net use to double-check.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜