Java api elasticsearch node error

I'm using the JAVA API. I tried the following:

org.elasticsearch.node.Node node = nodeBuilder().node();
Client client = node.client();

and then the following:

Client client = TransportClient.builder().build() 
 .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9200));

But they both gave me the following error:

Exception in thread "main" java.lang.NoClassDefFoundError:       com/google/common/collect/ImmutableMap
at org.elasticsearch.client.transport.TransportClient$Builder.<init>(
at org.elasticsearch.client.transport.TransportClient.builder(
at tools.Tools.Searcher(
at tools.Tools.main(
Caused by: java.lang.ClassNotFoundException:
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
... 4 more
Java Result: 1

I am using Elasticsearch 2.0.0 and it is running on port 9200

Help please? What is causing that error and how can I fix it?

Missing dependencies probably

I'm using a Java application project in netbeans. Are you talking about this dependency?


Where can I add this? I do not have a pom.xml file.

I think it's best to consult the netbeans community then.

This reads like one of the few transitive dependencies Elasticsearch has is missing: GitHub - google/guava: Google core libraries for Java is the project that has the class.

Hope this helps,