JAVA API connection issues

have tried several times to connect to Elasticsearch via the JAVA API on NetBeans and get an EventsDispatchThread exception. Any ideas.

I have used the below methods and my program hangs:

Node node = nBuilder.build().start();

OR

Builder settings = ImmutableSettings.settingsBuilder();
settings.build();
NodeBuilder nBuilder = nodeBuilder().settings(settings);
if (testing)
nBuilder.local(true);
//start it!
Node node = nBuilder.build().start();

OR

Node node = nodeBuilder().clusterName("Node Test").client(true).node();

OR

    Node node = nodeBuilder().local(true).
           settings(ImmutableSettings.settingsBuilder(). 
           put("network.host", "127.0.0.1").
           put("index.number_of_shards", 4). 
           put("index.number_of_replicas", 1). 
            build()).build().start(); 

Any ideas?