Problems with Rest Java swing consumption?

Asked

Viewed 38 times

0

I have a java swing application where I get a list of data from a webservice. When I run this by netbeans it does it right, now when I jar to send it to the client, the application just doesn’t make the request, it hangs. Follows the class:

public class Rest {

    public void get() {
        Client client = Client.create();
        WebResource webResource = client
                .resource("...");

        ClientResponse response = webResource.accept("application/json")
                .get(ClientResponse.class);

        if (response.getStatus()
                != 200) {
            throw new RuntimeException("Failed : HTTP error code : "
                    + response.getStatus());
        }

        String[] result = new String[2];

        String output = response.getEntity(String.class);

        result[0] = String.valueOf(response.getStatus());

        System.err.println(result[1]);

        JsonParser parser = new JsonParser();
        JsonObject obj = parser.parse(output).getAsJsonObject();

        Gson gson = new Gson();

        Arquivo arquivo = gson.fromJson(obj, Arquivo.class);
    }

}

and here and where my boot calls

private void bt_listaActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        new Rest().get();

    }
  • 1

    No error? Have you tried running the jar through a windows command terminal?

  • well that!!! , I just executed ! it’s not bringing dependency !

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.