mercredi 8 février 2017

How do I use the Jersey libraries in my Java application working in Netbeans

Vote count: 0

I am trying to follow Oracle's Developing RESTful Web Service Clients tutorial.

I am using Netbeans 8.0 with Java 1.7 on Windows 7.

I am trying to use their example to create a simple web service client:

package samples.helloworld.client;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;

public class helloWorldClient {
    public helloWorldClient() {
        super();
    }

    public static void main(String[] args) {
        Client c = Client.create();
        WebResource resource = c.resource("http://localhost:7101/RESTfulService-Project1-context-root/jersey/helloWorld");
        String response = resource.get(String.class);
    }
}

In Netbeans I created a new Java Application:

File -> New Project -> Java -> Java Applicaiton

It looks like Netbeans already comes with the Jersey libraries, because when I go to:

Tools -> Libraries

I see Jersey 2.0 (JAX-RS RI) in the list of libraries on the left side of the window. However, I keep getting the class not found error on the import statements. I even tried downloading the libraries myself from the Jersey site and creating my own library, but I still get the class not found errors.

I cannot use Maven to pull in the libraries automatically, so I need to do it locally.

So, how do I get this working?

asked 24 secs ago

Let's block ads! (Why?)



How do I use the Jersey libraries in my Java application working in Netbeans

Aucun commentaire:

Enregistrer un commentaire