Java Eclipse 错误:“设置构建路径”遇到错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1888075/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse Error: 'Setting build path' has encountered error
提问by Anand
I am using an API called jtwitter. It has a single jar file jtwitter.jar I have been working with it and maintained it using git. I hosted the code in github. For somedays, i have not touched its code. Today, when i cloned my git repo (actually my system got a crash some days back so I had to clone ) and loaded the project into eclipse. Now when i wanted to add the jtwitter.jar into the buildpath, the following error occurs.
我正在使用一个名为 jtwitter 的 API。它有一个 jar 文件 jtwitter.jar 我一直在使用它并使用 git 维护它。我在github中托管了代码。有几天,我没有接触过它的代码。今天,当我克隆我的 git 存储库时(实际上我的系统几天前崩溃了,所以我不得不克隆)并将项目加载到 eclipse 中。现在,当我想将 jtwitter.jar 添加到构建路径中时,会发生以下错误。
I am giving the partial exception stack trace here
我在这里给出部分异常堆栈跟踪
java.io.FileNotFoundException: D:\workspace\ltwitter\.classpath (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at org.eclipse.core.internal.filesystem.local.LocalFile.openOutputStream(LocalFile.java:377)
at org.eclipse.core.internal.localstore.FileSystemResourceManager.write(FileSystemResourceManager.java:956)
please help.
请帮忙。
采纳答案by Ed Griebel
Make sure that the directory and file are still there, take a look at D:\workspace\ltwitter is a valid path, has a .classpath file and it is readable. Try opening .classpath in Notepad for a test of readability.
确保目录和文件仍然存在,看看 D:\workspace\ltwitter 是一个有效路径,有一个 .classpath 文件并且它是可读的。尝试在记事本中打开 .classpath 以测试可读性。
回答by Thomas L?tzer
Does D:\workspace\ltwitter\
exist? Do you have access to it? Is this where the project lies?
是否D:\workspace\ltwitter\
存在?你可以访问它吗?这是项目所在的地方吗?
You can fix the build path using the context menu of the project -> Build Path -> Configure Build Path. There you can see all entries, the ones which are not valid are marked as such.
您可以使用项目的上下文菜单 -> Build Path -> Configure Build Path 来修复构建路径。在那里你可以看到所有条目,无效的条目被标记为这样。
回答by Alexander Pogrebnyak
Check directory permissions on D:\workspace\ltwitter
and file permissions on D:\workspace\ltwitter\.classpath
.
检查 上的目录权限D:\workspace\ltwitter
和 上的文件权限D:\workspace\ltwitter\.classpath
。
File Properties->Security tab in Windows Explorer
Windows 资源管理器中的文件属性-> 安全选项卡
回答by VonC
Assuming the directory exist and has the proper authorization, check also your logs for missing properties during eclipse launch (see this thread)
假设该目录存在并具有适当的授权,请在 eclipse 启动期间检查您的日志是否缺少属性(请参阅此线程)
If you find some missing properties, try this eclipse.ini
如果你发现一些缺失的属性,试试这个 eclipse.ini
回答by Sentry
I had the same problem, and I found out it was because the .classpath
file was hidden. Removing the hidden attribute resolved the issue.
我遇到了同样的问题,我发现这是因为.classpath
文件被隐藏了。删除隐藏属性解决了这个问题。
回答by victor
I had the same issue with 64-bit Windows 7 and it was resolved by clearing the Hidden attribute.
我在 64 位 Windows 7 上遇到了同样的问题,并通过清除 Hidden 属性解决了这个问题。
回答by Sathya
On Mac, Below command helped me to resolve this.
在 Mac 上,下面的命令帮助我解决了这个问题。
sudo chmod 777 .classpath
须藤chmod 777 .classpath