如何在 eclipse sdk 中取回“引用库”文件夹?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1776254/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 19:01:27  来源:igfitidea点击:

How do I get the "referenced libraries" folder back In the eclipse sdk?

eclipse

提问by Parastar

I use the eclipse Ganymede sdk for developing Java apps. I'm having a strange Issue.

我使用 eclipse Ganymede sdk 来开发 Java 应用程序。我有一个奇怪的问题。

Everything was working fine until recently where the "referenced Libraries " folder went missing from the explorer.

一切正常,直到最近“引用的库”文件夹从资源管理器中丢失。

I used to upload the jar's I need Into the workspace. I uploaded the jars In a folder named "lib" and after refreshing the project folder In eclipse that folder "lib" containing the Jar appears. Now,the Issue arises,when I right click on the jar and select "add to path" the jar Instead of appearing In the "referenced libraries" folder just disappears. Note:the referenced Library was never there In the first place,I need to find a way to get the folder back.

我曾经将我需要的 jar 上传到工作区。我将 jars 上传到名为“lib”的文件夹中,并在刷新项目文件夹后在 eclipse 中出现包含 Jar 的文件夹“lib”。现在,问题出现了,当我右键单击 jar 并选择“添加到路径”时,jar 而不是出现在“引用的库”文件夹中,而是消失了。注意:引用的库从来没有存在过首先,我需要找到一种方法来取回文件夹。

here's a snapshot of my eclipse framework : http://www.flickr.com/photos/38561743@N03/4122304046/sizes/o/

这是我的 Eclipse 框架的快照:http: //www.flickr.com/photos/38561743@N03/4122304046/sizes/o/

回答by sugam

The root - Referenced Libraries - of the lib jar disappear if you open J2EE perspective, leaving all the jar in the main project root folder. This is very annoying so, Please change e perspective from J2EE to Java.

如果您打开 J2EE 透视图,lib jar 的根 - 引用库 - 将消失,将所有 jar 留在主项目根文件夹中。这很烦人,所以请把视角从 J2EE 换成 Java。

回答by Pascal Thivent

Did you uncheck the Show 'Referenced Libraries' Node(accessible through the menu for Package Explorer: the small triangle in the explorer's title bar)?

您是否取消选中显示“参考库”节点(可通过包资源管理器的菜单访问:资源管理器标题栏中的小三角形)?

(EDIT: The OP provided a screen shot showing that Show 'Referenced Libraries' Nodeis checked in comment to this answer. He confirmed that libraries are not filtered too in a comment to another answer. So, actually, I don't know what is happening here. Strangely, I can't see the "JRE System Library" neither and this seems weird. So something must be wrong indeed, but I don't know what. This is not really a good solution but if you can't solve it, maybe consider reinstalling Eclipse.)

(编辑:OP 提供了一个屏幕截图,显示在对此答案的评论中选中了Show 'Referenced Libraries' Node。他确认库没有在另一个答案的评论中过滤。所以,实际上,我不知道是什么正在这里发生。奇怪的是,我也看不到“ JRE 系统库”,这看起来很奇怪。所以确实肯定有问题,但我不知道是什么。这不是一个很好的解决方案,但如果你可以的话t解决它,也许考虑重新安装Eclipse。)

回答by rottweiler

Usually JavaEE is the default perspective. Change it to Java perspective from

通常 JavaEE 是默认的透视图。将其更改为 Java 透视图

Window -> Open Perspective -> Java

This should solve the problem.

这应该可以解决问题。

You can make Java as the default perspective

您可以将 Java 作为默认透视图

Window -> Preferences -> General -> Perspectives

So next time when you open another workspace, Java will be the default perspective and you won't be surprised that the Referenced Librarieshas disappeared.

因此,下次当您打开另一个工作区时,Java 将成为默认透视图,并且您不会对引用的库消失感到惊讶。

回答by mhaller

Please post the contents of your .projectand more importantly of the .classpathfiles. They're located in the root of your project, but hidden. Use either Windows Explorer or the Eclipse Navigatorview to see them.

请张贴您的.project以及更重要的.classpath文件的内容。它们位于项目的根目录中,但处于隐藏状态。使用 Windows Explorer 或 Eclipse Navigator视图来查看它们。

The .classpathshould contain an entry like the following:

.classpath应包含如下条目:

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

For libraries, the .claspathfile should contain entries like this:

对于库,该.claspath文件应包含如下条目:

<classpathentry kind="lib" path="lib/somelib.jar"/>

回答by Sajan John

Same issue I had where Reference library does not appear. Close the package explorer and reopen again , it worked.

我在参考库没有出现的地方遇到了同样的问题。关闭包浏览器并重新打开,它起作用了。

回答by Rungano Mudimu

This is simple:

这很简单:

Firstly make sure that Show 'Referenced Libraries' Node is checked. This can be found by clicking the down arrow in the Package Explorer.

首先确保选中 Show 'Referenced Libraries' 节点。这可以通过单击包资源管理器中的向下箭头找到。

Then, what you probably want to do is ensure all the dependent libraries are in the classpath. If its a Maven project simply right-click the project, Properties, then under the Libraries tab 'Add variable'. Then navigate (and select) to one of the dependencies using the M2_REPO variable.

然后,您可能想要做的是确保所有依赖库都在类路径中。如果它是一个 Maven 项目,只需右键单击该项目,属性,然后在库选项卡下的“添加变量”。然后使用 M2_REPO 变量导航(并选择)到依赖项之一。

You should see the Referenced Libraries come up. All you have to do from here is make sure each classpath entry (type "var") you need is present in the .classpath file.

您应该会看到引用的库出现。从这里开始,您要做的就是确保您需要的每个类路径条目(类型“var”)都存在于 .classpath 文件中。

回答by Eskinder

Even if you are in the Java perspective and opened your project in project explorer view you wouldn't get what you need. you need to be in the package explorer view to get the Referenced Libraries.

即使您在 Java 透视图中并在项目资源管理器视图中打开您的项目,您也不会得到您所需要的。您需要在包资源管理器视图中才能获取引用的库。

Window --> Show View --> Package Explorer

窗口 --> 显示视图 --> 包资源管理器

回答by Priyanka Kuhswaha

Change perspective to Java perspective by following below instructions:

按照以下说明将透视图更改为 Java 透视图:

Follow this : Window -> Open Perspective -> Java

按照这个: Window -> Open Perspective -> Java

This should solve the problem and put all the Jars back to Referenced Libraries.

这应该可以解决问题并将所有罐子放回参考库。

回答by skaffman

Sounds like you've accidentally enabled a filter on the explorer view. Bring up the "view menu" item (the downward-pointing arrow at the top right of the explorer pane), pick "filters", and make sure "libraries from external" and/or "libraries from project" is not selected.

听起来您不小心在资源管理器视图中启用了过滤器。调出“查看菜单”项(资源管理器窗格右上角的向下箭头),选择“过滤器”,并确保未选择“来自外部的库”和/或“来自项目的库”。

回答by Ankur

I have a hunch that this is because the lib folder is actually empty and there is nothing aded to classpath yet.

我有一种预感,这是因为 lib 文件夹实际上是空的,并且还没有添加到类路径中。

This is how you can be sure 1. In package explorer, select "lib" folder and press F5 (refresh). If it doesn't gets the + sign in front of it, the folder is empty. 2. Right click on "lib" and select "Go Into". If the package explorer gets empty, the folder is empty. Select the back arrow icon from the package explorer view menu to get back. 3. Select "lib" menu and do press "Alt + Enter". You should see a properties dialog. Note the path in front of "Location". Copy it and open this location is windows explorer. You can verify that its actually empty or not.

这就是您可以确定的方法 1. 在包资源管理器中,选择“lib”文件夹并按 F5(刷新)。如果它前面没有+号,则该文件夹为空。2. 右键单击​​“lib”并选择“Go Into”。如果包资源管理器为空,则该文件夹为空。从包资源管理器视图菜单中选择后退箭头图标返回。3. 选择“lib”菜单并按“Alt + Enter”。您应该会看到一个属性对话框。注意“位置”前面的路径。复制它并打开这个位置是 windows 资源管理器。您可以验证它是否真的为空。

You will see referenced libraries only when a jar has been added to the build path (I guess you know this already).

只有在将 jar 添加到构建路径时,您才会看到引用的库(我想您已经知道了)。

Try adding a dummy jar to build patch to see if referenced libraries shows up. You may use the "Add external jar" button on the "Libraries" tab of the "Java Build Patch" dialog for quickly verifying this.

尝试添加一个虚拟 jar 来构建补丁以查看引用的库是否出现。您可以使用“Java Build Patch”对话框的“Libraries”选项卡上的“Add external jar”按钮来快速验证这一点。