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?
3 Answers
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.

- 6,865
- 8
- 49
- 75

- 334,321
- 69
- 703
- 674
-
3If they're not part of the JDK, then why are the classes defined in the Java JDK? See http://docs.oracle.com/javaee/6/api/javax/ws/rs/Path.html – David Brossard Feb 05 '14 at 20:29
-
6Because they are part of the JavaEE specification and not part of the base Java SDK. – Kolban Sep 06 '14 at 15:08
-
Jersey 2.25.1 includes `javax.ws.rs-api-2.0.1.jar`, which contains the classes that you need. You can download the `Jersey JAX-RS 2.0 RI bundle` from https://jersey.java.net/download.html. – james.garriss Apr 26 '17 at 18:14
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

- 190
- 1
- 6
-
3Better late than never. Maven rep points to `JSR 311` and today we are at `JSR 339-JAX-RS-2.0` – Tirath Apr 17 '16 at 07:32
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.

- 60
- 1
- 2
- 9

- 10,819
- 1
- 66
- 58