在 Windows 7 上:相同的路径,但资源管理器和Java 看到的文件与 Powershell 不同
提交供您批准,一个关于一个可怜的小java进程被困在暮光区的故事......
在我举手并只是说NTFS分区被破坏之前,对我所看到的有什么合理的解释吗?我有一个带有这样路径的文件,
C:\Program Files\Company\product\config\file.xml
我在升级后阅读该文件并看到一些奇怪的东西。 Eclipse 和我的 Java 应用程序仍然看到该文件的旧版本,而其他一些程序则看到新版本。让我确信不是我的胖手指引起问题的测试是这样的:
在资源管理器中,我输入了上述路径,资源管理器显示了文件的旧版本。通过 Ctrl-F5 强制资源管理器重新加载仍然会产生旧版本。这是我在 Java 中得到的行为。现在,在 PowerShell 中,我输入
more "C:\Program Files\Company\product\config\file.xml"
“我剪切并粘贴了来自资源管理器的路径”,以确保我没有搞砸任何事情,并且它会向我显示该文件的新版本。
因此,对于编程方面来说,是否有缓存或某些系统组件可以存储这个过时的引用。我是否负责检查或重置某些类别的文件?我可以想象有人在如何处理 xml 文件方面具有“创造性”,以提供一些额外的功能。但这可能只是一种无聊的情况。
任何见解表示赞赏...谢谢!
Submitted for your approval, a story about a poor little java process trapped in the twilight zone...
Before I throw up my hands and just say that the NTFS partition is borked is there any rational explanation of what I am seeing. I have a file with a path like this
C:\Program Files\Company\product\config\file.xml
I am reading this file after an upgrade and seeing something wonky. Eclipse and my Java app are still seeing the old version of this file while some other programs see the new version. The test that convinced my it was not my fat finger that caused the problem was this:
In Explorer I entered the above path and Explorer displayed the old version of the file. Forcing Explorer to reload via Ctrl-F5 still yields the old version. This is the behavior I get in Java. Now in PowerShell I enter
more "C:\Program Files\Company\product\config\file.xml"
I cut and past the path from Explorer to make sure I am not screwing anything up and it shows me the new version of the file.
So for the programming aspect of this, is there a cache or some system component that would be storing this stale reference. Am I responsible for checking or reseting that for some class of files. I can imagine somebody being "creative" in how xml files are processed to provide some bell or whistle. But it could be a case of just being borked.
Any insights appreciated...Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是由于 UAC 虚拟化。您看到的额外文件位于
C:\Users\\AppData\Local\VirtualStore\Windows
中。 Vista 中引入了这一点。 更多信息请访问 Microsoft Technet。您还可以通过在资源管理器中浏览到
c:\program files
,然后单击“兼容性文件”来获取该文件的幽灵版本。That's due to UAC virtualization. The extra files thatyou see live in
C:\Users\<USER>\AppData\Local\VirtualStore\Windows
. That got introduced in Vista. More info can be found at Microsoft Technet.You can also get to the ghost version of the file by browsing to
c:\program files
in Explorer and then clicking "Compatibility files".Eclipse 有自己的世界观,如果您在 Eclipse 外部更改了文件:在 Eclipse 包视图中选择它(或其所在的包/文件夹),然后从上下文菜单中选择
刷新
。我猜测这将使您在 Eclipse 中的 Java 应用程序看到正确的版本(保持 Eclipse 项目和文件系统同步是个好主意。)
Eclipse has its own view of the world, if you changed the file outside of eclipse: select it (or the package / folder it is in) in the eclipse package view and select
refresh
from the context menu.It's my guess that will make your Java application in eclipse see the correct version (its a good idea to keep your eclipse project and the filesystem in sync.)