0

I am trying to create a Java Rest Client which will download a file via a get request and will use basic authentication. I have a dynamic web project in eclipse, where i put the Jersey Jars downloaded from https://jersey.java.net/download.html into the web-inf>lib folder.

  • Q1 - Eclipse is not able to identify package javax.ws.rs.* and shows compilation errors.
  • Q2- I want to package this as a Jar(I have a main class) and want to execute it from command line. Is it possible ? If not how can I do this.

Update: Below is the screenshot of what I have done till now . I am not sure if I am using the correct Jar Files .

Eclipse Screenshot

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
LK_sde89
  • 167
  • 1
  • 1
  • 9
  • Please would you explain your problem a little bit more. Show us your research results. – Meiko Rachimow Mar 17 '16 at 07:35
  • I see two questions here. 1) How include a jar in eclipse?http://stackoverflow.com/questions/3280353/how-to-import-a-jar-in-eclipse – Héctor Mar 17 '16 at 08:03
  • 2) How package an executable jar? http://stackoverflow.com/questions/5258159/how-to-make-an-executable-jar-file – Héctor Mar 17 '16 at 08:04

1 Answers1

0

Your Jersey Jar files does not contain the Client, ClientBuilder and Response classes. They are available here www.java2s.com/Code/JarDownload/javax.ws/javax.ws.rs-api-2.0.jar.zip. Download and use it. You need to import javax.ws.rs.core.Response also in your code. You can generate a runnable JAR file and execute it.

Thanga
  • 7,811
  • 3
  • 19
  • 38