在 Eclipse 中安装【java 库】
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/207304/
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
Install [java library] in Eclipse
提问by Edward Z. Yang
I just downloaded Eclipse several hours ago, and needed to add Java3D to the classpath. Installing it went without a hitch, but Eclipse can't seem to find the documentation folders so that it can give super-IDE functionality, such as autocomplete and method signatures.
几个小时前我刚刚下载了 Eclipse,需要将 Java3D 添加到类路径中。安装它很顺利,但 Eclipse 似乎无法找到文档文件夹,因此它可以提供超级 IDE 功能,例如自动完成和方法签名。
While I know how I would add them individually, this lead me to the question; what is the "correct" way to install a Java library in Eclipse? Is there a special directory format I should follow? Is there a plugin that already did this for me? (The answer to that is yes, but I don't know how to use it, or whether or not it's appropriate).
虽然我知道如何单独添加它们,但这让我想到了这个问题;在 Eclipse 中安装 Java 库的“正确”方法是什么?是否有我应该遵循的特殊目录格式?有没有插件已经为我做了这个?(答案是肯定的,但我不知道如何使用它,也不知道它是否合适)。
Thanks!
谢谢!
Edit 1:It seems to me that someone down-voted the question. May I ask why?
编辑 1:在我看来,有人对这个问题投了反对票。我可以问为什么吗?
Edit 2:So after monkeying around with the JARs, it seems that manually setting the doc path for each JAR in the library seems to be the least-error prone way.
编辑 2:因此,在与 JAR 混在一起之后,似乎为库中的每个 JAR 手动设置文档路径似乎是最不容易出错的方式。
采纳答案by anjanb
when you add a .JAR(library) to your project in the LIBRARIES tab for your project, you have the option of attaching the javadoc directory for the jar.
当您在项目的 LIBRARIES 选项卡中将 .JAR(library) 添加到项目时,您可以选择附加 jar 的 javadoc 目录。
So, go to the LIBRARIES tab of the "java build path" for your projects. select your jar. expand the (+) sign and you will see that you can set the javadoc. path.
因此,转到项目的“java 构建路径”的 LIBRARIES 选项卡。选择你的罐子。展开 (+) 号,您将看到可以设置 javadoc。小路。
good luck,
祝你好运,
回答by Randy Alvarez
I think I've got it (had the same issue as you). Better late than never.
我想我已经明白了(和你有同样的问题)。迟到总比不到好。
Go here - http://java3d.java.net/binary-builds.htmland download the documentation zip (j3d-1_5_2-api-docs.zip).
去这里 - http://java3d.java.net/binary-builds.html并下载文档 zip (j3d-1_5_2-api-docs.zip)。
Extract the directory anywhere on your HD (Right in the Java3d folder is fine).
将目录解压缩到 HD 上的任何位置(在 Java3d 文件夹中就可以了)。
Link the Jar's JavaDoc listing to that Folder (java build path >> Libraries >> expand the Jar Listing >> JavaDoc Location >> browse to the folder location, then validate). Do it for each j3d Jar.
将 Jar 的 JavaDoc 列表链接到该文件夹(java 构建路径 >> 库 >> 展开 Jar 列表 >> JavaDoc 位置 >> 浏览到文件夹位置,然后验证)。为每个 j3d Jar 执行此操作。
That should integrate the J3D Javadoc.
那应该集成 J3D Javadoc。
回答by MetroidFan2002
As far as I know (haven't used 3.4 very much thus far), Eclipse has two options for the automatic showing of Javadocs. The first is a JavaDoc jar to attach to the jar file. The second is having the javadoc in a source jar which is attached to the jar to show the source.
据我所知(到目前为止还没有经常使用 3.4),Eclipse 有两个选项可以自动显示 Javadoc。第一个是附加到 jar 文件的 JavaDoc jar。第二个是在源 jar 中包含 javadoc,该源 jar 附加到 jar 以显示源。
A directory, if I recall correctly, will not provide autocompletion of javadoc. However, if you press "F1", you will be able to access the javadoc via the help menu.
一个目录,如果我没记错的话,不会提供 javadoc 的自动完成。但是,如果您按“F1”,您将能够通过帮助菜单访问 javadoc。
You might try placing the documentation directory into a jar file, and attaching it to the jar file and see if that tricks Eclipse.
您可以尝试将文档目录放入 jar 文件中,并将其附加到 jar 文件中,看看这是否会欺骗 Eclipse。
回答by tunaranch
I cheat; All my java projects are built with maven, so I use maven to generate an eclipse project, with classpaths etc already setup, with a simple 'mvn eclipse:m2eclipse'.
我作弊;我所有的java项目都是用maven构建的,所以我使用maven来生成一个eclipse项目,类路径等已经设置好了,一个简单的'mvn eclipse:m2eclipse'。