Where is javax.annotation

时光毁灭记忆、已成空白 提交于 2019-12-08 14:48:48

问题


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...

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

At step 15 I need to add the following dependency packages to import in my bundle. 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.*

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

What obvious mistake am I missing?


回答1:


The version for 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

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




回答2:


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




回答3:


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.

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

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

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



来源:https://stackoverflow.com/questions/22589302/where-is-javax-annotation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!