在Eclipse项目中缺少.classpath文件 [英] Missing .classpath file in Eclipse project

查看:610
本文介绍了在Eclipse项目中缺少.classpath文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我不再使用了几个星期后才回到了一个项目。该项目没有在导入的Eclipse中创建,项目工作区中没有'.classpath'文件。



我以前已经成功添加了新的。 jar文件只需右键单击并添加到构建路径,但由于无关错误,我不得不将文件重新添加到构建路径,现在,当我尝试添加一个新的.jar文件时,我得到以下错误:

 添加库时出错

原因:
无法写入文件C:\Users\Charles\workspace\hive\.classpath

或者,如果我尝试使用配置构建路径添加文件,我会收到以下错误:

 '设置构建路径'遇到了问题。 

无法写入文件:
C:\Users\Charles\workspace\hive\.classpath

在添加.jar文件之前,我先前有这个项目的版本,并且没有任何一个.classpath文件,所以我没有意外删除它任何一点。



如果有人可以帮助我,我会非常感激(我迫切需要添加这些.jar文件,所以我可以做一些实际的工作)。



令我感到厌烦的事情是我以前的工作,但是我试图在早期版本的项目中做同样的事情,我总是得到相同的错误。

解决方案

我也有同样的问题。我刚刚设置了一台新的PC机,我将项目转移到新的PC机上,点击了工作区目录,并更改了权限,以便我(新PC上的'我')拥有所有子目录中的所有文件。但是,即使这样做,eclipse也无法写入.classpath文件。我证实我可以使用记事本写信给他们,而且工作正常。我也证实了O / S知道我真的是业主,但没有帮助。我也尝试以管理员身份运行,但也没有帮助。



然后我发现这个链接: http://blog.ryanrampersad.com/2010/03/03/setting- build-path-has-encounter-a-in-eclipse / ,这表明当您将文件复制到Windows7机器时,Windows可能会在文件中设置hidden属性,如果发生这种情况,日食不能用它。我从工作空间目录中找到文件,查找'.project'(随后是'.classpath'),并选择所有文件,右键单击,并取消选中hidden属性。这固定了我的问题。


I have recently returned to a project after not using it for a couple of weeks. The project was not created in Eclipse it was imported, and there is no '.classpath' file in the project workspace.

I am sure that previously I successfully added new .jar files by simply right clicking them and going to 'Add to build path', but thanks to an unrelated error I had to re-add the files to the build path, and now whenever I try to add a new .jar file I get the following error:

Error while adding a library

Reason:
Could not write file C:\Users\Charles\workspace\hive\.classpath

Or, if I try to add a file using Configure build path, I get the following error:

'Setting build path' has encountered a problem.

Could not write file:
C:\Users\Charles\workspace\hive\.classpath

I have earlier versions of this project prior to adding .jar files, and there is no .classpath file for any of them either, so I haven't accidentally deleted it at any point.

If anyone can help me out at all, I'd be ever so grateful (I desperately need to add these .jar files so I can do some actual work).

The thing that annoys me the most is I'm sure it worked before, but I have tried to do the same in earlier versions of the project and I am always getting the same error now.

解决方案

I had the same problem. I had just setup a new PC, I transferred my projects to the new PC, clicked on the workspace directory, and changed the permission so that I (the 'me' on my new PC) owned all the files in all all sub-directories. However, even after doing this, eclipse couldn't write to the .classpath files. I verified that I could write to them using notepad, and that worked fine. I also verified that the O/S knew I was really the owner, but it didn't help. I also tried running as admin, but that didn't help either.

Then I found this link: http://blog.ryanrampersad.com/2010/03/03/setting-build-path-has-encountered-a-problem-in-eclipse/, which indicates that when you copy files to a windows7 machine, windows may set the 'hidden' attribute on the file, and when this happens, eclipse can't work with it. I did a find files from the workspace directory, looking for '.project' (and subsequently '.classpath'), and selected all the files, right-clicked, and un-checked the 'hidden' attribute. This fixed my problem.

这篇关于在Eclipse项目中缺少.classpath文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆