对于 Windows 7 Ultimate N,directory.exists() 返回 false
好吧,这个问题直接涉及Windows 7。
我在Windows XP和Windows 7上运行相同的代码。
在Windows XP中这是正确的,在Windows 7中这是错误的!
if (file.exists() || file.getAbsoluteFile().exists())
有什么想法吗?
该 URL 指向该文件所在的另一台服务器。
已编辑
用户有权查看/创建/删除/编辑目录。我尝试从 Windows 7 通过 Windows 的“运行”选项访问该文件夹并创建另一个文件夹,并且没有出现权限错误。
URL 是 (+-):
\\\\myip\\C$\\Devel\\workspace\\project\\HibernateSearch\\indexes
已编辑 2
我将 URL 更改为该计算机上的本地 URL,现在它找到了目录,一切都很好。
与网络 IP 相比,正确的 URL 应该是什么?
Well, this question refers directly to windows 7.
I run the same code on windows xp and on windows 7.
In windows XP it's true, and in windows 7 it's false!!
if (file.exists() || file.getAbsoluteFile().exists())
Any ideas?
The URL is to another server where the file is located.
EDITED
The user has permission to view/create/delete/edit the directory. I tried from that windows 7 to access by Run option of windows the folder and create another one, and got no permission errors.
The URL is (+-):
\\\\myip\\C$\\Devel\\workspace\\project\\HibernateSearch\\indexes
EDITED 2
I changed the URL to be local on that machine, and now it finds the directory and everything is fine.
What should be the correct URL than for network IP?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
是否有可能win7机器无法访问该文件所在的服务器?
您是否尝试从命令行/Windows 资源管理器访问该文件?
Is it possible that the win7 machine does not have access to the server where the file is located?
Did you try to access the file from commands line/windows explorer?
这是一种非常不常见的 URL 格式。也许微软已经修复了 Win 7 中的某些问题;-)。尝试
file://myip/C|/Devel/workspace/project/HibernateSearch/indexes
That is a very uncommon URL format. Maybe MS has fixed something in Win 7 ;-). Try
file://myip/C|/Devel/workspace/project/HibernateSearch/indexes
问题出在
C$
上,我将
Devel
目录更改为公开共享,并将 URL 更改为:\\myip\Devel\workspace\project\HibernateSearch \indexes(无需定义驱动器)
The problem was with the
C$
I changed the
Devel
directory to be shared in public, and the URL was changed to:\\myip\Devel\workspace\project\HibernateSearch\indexes (no need to define the drive)
唔。权限问题?也许Win7用户身份实际上看不到该文件?
Hmm. Permission problem? Maybe the Win7 user identity can't actually see the file?
您要查找哪个文件?如果是系统文件/文件夹,则可能存在于 Windows XP 中,而不存在于 Windows 7 中。
Which file are you looking for? If it is a system file / folder, maybe it exists in Windows XP and not in Windows 7.