Eclipse给出错误“...不是链接资源的有效位置”。 [英] Eclipse gives error "... is not a valid location for linked resources."

查看:982
本文介绍了Eclipse给出错误“...不是链接资源的有效位置”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在Eclipse中为我的构建路径配置添加一个新的Classpath变量,并且我添加的路径是当前工作区是一个子目录的目录,Eclipse会给出错误:

When I try to add a new Classpath Variable in Eclipse for my Build Path configuration, and the path I add is a directory that the current workspace is a subdirectory of, Eclipse gives the error:

'C:\JavaStuff' is not a valid location for linked resources.

为什么Eclipse强加这个限制?我不能想到一个很好的理由...我可能想把我的JAR放在 C:\JavaStuff\libs 中,让我的工作区在code> C:\JavaStuff\workspace ,然后通过 JAVASTUFF_DIR\libs 引用lib(在我的机器上),其中 JAVASTUFF_DIR C:\JavaStuff 。这个限制阻止我这样做。

Why does Eclipse impose this restriction? I can't think of a good reason for it... I might want to put my JARs in C:\JavaStuff\libs and have my workspace in C:\JavaStuff\workspace, then reference libs (on my machine) via JAVASTUFF_DIR\libs where JAVASTUFF_DIR is C:\JavaStuff. This restriction prevents me doing this.

推荐答案

好的,我遇到这个问题的原因不是Classpath Variable ...事实上,我正在尝试将其添加到Java构建路径,因为我创建变量的方式是转到Java构建路径,然后单击添加变量。创建指向我工作区上方目录的变量后,我可以从该对话框中删除,并尝试将该父目录添加到我的构建路径。

OK, the reason I was having this problem was not the Classpath Variable... it was the fact that I was trying to add it to the Java Build Path, because the way I was creating the variable was to go to the Java Build Path and click 'Add Variable'. After creating the variable pointing to the directory above my workspace, I OK'd out of that dialog and it tried to add that parent dir to my build path.

看起来像Eclipse希望您通过Classpath添加JAR的方式变量是添加变量,选择表示基本路径的变量,确定回到Java构建路径窗口,然后编辑已添加的条目,并手动添加其余路径(即转到 MY_BASE_DIR MY_BASE_DIR / libs / library.jar 。有点无礼。

Looks like the way Eclipse wants you do add JARs via Classpath Variables is 'Add Variable', select the variable representing your base path, OK back up to the Java Build Path window, then edit the entry that's been added and manually add the rest of the path on (ie. turn MY_BASE_DIR to MY_BASE_DIR/libs/library.jar. A little bit unintuative.

这篇关于Eclipse给出错误“...不是链接资源的有效位置”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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