javax.annotation 在哪里

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

Where is javax.annotation

javaeclipseeclipse-rcp

提问by Respect2All

Ok, so this is probably a NooB question (I'm more of a C++ guy), but I'm lost in the java woods and its frameworks forests...

好的,所以这可能是一个 NooB 问题(我更像是一个 C++ 人),但我迷失在 Java 森林及其框架森林中......

I'm trying to look into eclipse RCP development. For that I'm following this well-known tutorial: http://www.vogella.com/tutorials/EclipseRCP/article.html

我正在尝试研究 Eclipse RCP 开发。为此,我正在关注这个著名的教程:http: //www.vogella.com/tutorials/EclipseRCP/article.html

At step 15 I need to add the following dependency packages to import in my bundle. javax.annotation javax.injection

在第 15 步,我需要添加以下依赖包以导入到我的包中。javax.annotation javax.injection

The problem is that I cannot select these (they are not in the selection list) I do have javax.el javax.servlet.* and javax.xml.*

问题是我无法选择这些(它们不在选择列表中)我确实有 javax.el javax.servlet.* 和 javax.xml.*

Looking at http://docs.oracle.com/javase/7/docs/api/overview-summary.htmlsuggests that this should be part of the standard java.

查看 http://docs.oracle.com/javase/7/docs/api/overview-summary.html表明这应该是标准 java 的一部分。

What obvious mistake am I missing?

我错过了什么明显的错误?

回答by peter.petrov

In Java version >= 6, you should not need to add them explicitly.
They are part of the JDK. Just try to skip adding them, maybe
the list of instructions is outdated.

在 Java 版本 >= 6 中,您不需要显式添加它们。
它们是 JDK 的一部分。试着跳过添加它们,也许
指令列表已经过时了。

Before Java 6, you would have needed to add this jar, I think: jsr250-api-1.0.jar.

在 Java 6 之前,您需要添加这个 jar,我认为:jsr250-api-1.0.jar

http://central.maven.org/maven2/javax/annotation/jsr250-api/1.0/

http://central.maven.org/maven2/javax/annotation/jsr250-api/1.0/

http://download.java.net/maven/2/javax/annotation/jsr250-api/1.0/

http://download.java.net/maven/2/javax/annotation/jsr250-api/1.0/

回答by Stefan Gro?mann

The version for JavaEE 7:

JavaEE 7 的版本:

<dependency>
    <groupId>javax.annotation</groupId>
    <artifactId>javax.annotation-api</artifactId>
    <version>1.3.2</version>
</dependency>

See: http://mvnrepository.com/artifact/javax.annotation/javax.annotation-api

请参阅:http: //mvnrepository.com/artifact/javax.annotation/javax.annotation-api

If you use Java 8: http://docs.oracle.com/javase/8/docs/api/javax/annotation/package-summary.html

如果您使用 Java 8:http: //docs.oracle.com/javase/8/docs/api/javax/annotation/package-summary.html

回答by Alice Purcell

Your comment indicates this is for Guava, so you want the JSR305 library, which extends the javaxpackage.

您的评论表明这是针对 Guava 的,因此您需要扩展包的 JSR305 库javax