Can't find javax.ws.rs package in jdk

穿精又带淫゛_ 提交于 2019-12-18 03:04:09

问题


I'm trying to get into JAX-RS. My project jdk is set to 1.7.03. Does there have to be definitions of annotations for JAX-RS(javax.ws.rs)? If not, where I can find them?


回答1:


These classes (JSR 311: JAX-RS: The JavaTM API for RESTful Web Services) are not part of the JDK. You need to include appropriate JAR file to your CLASSPATH. You can find the API e.g. in maven repository.

Also check out apache-cxf, jersey (reference implementation), resteasy from JBoss, restlet and few other JAX-RS implementations.




回答2:


Try: http://download.oracle.com/otndocs/jcp/jaxrs-2_0_rev_A-mrel-spec/index.html

Download: javax.ws.rs-api-2.0.rev.A.jar

Then add to your Project Properties(YourProjectName)->Libraries->Add JAR/Folder




回答3:


It doesn't matter what your JDK is set to.

Go here= http://www.java2s.com/Code/Jar/j/Downloadjavaxwsrsjar.htm

Or type in "Download javax.ws.rs" into Google.

Download “javax.ws/javax.ws.rs.jar.zip”

Unzip to your desktop. The resulting file should be a jar file. Open your project preferences and add it as external jar.

Select your javax.ws.rs.jar file from your Desktop.

Click “Apply” and then “OK”.

Now you should be able to use the javax.ws.rs libraries. You can test it by typing "import javax.ws.rs.GET;" in one of your Java classes.



来源:https://stackoverflow.com/questions/10869977/cant-find-javax-ws-rs-package-in-jdk

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