How to set path.home in ubunu?

i used eclipse for java programming.
when i connect to elastic search to java then i got "path.home is not configured" this type of error.
My code is

Settings settings = Settings.settingsBuilder()
.put("path.home", "/home/amit/elasticsearch-2.1.0/bin").build();
TransportClient client = TransportClient.builder().settings(settings).build();

Settings settings = Settings.settingsBuilder()
        .put("path.home", "/home/amit/elasticsearch-2.1.0").build();
Client client = TransportClient.builder().settings(settings).build();

Note that it can be any path. You don't need to have an elasticsearch locally installed to use a transport client. So basically /tmp might work as well...

I think it has been solved recently (the fact you have to define path.home) but unsure though. May be you could test with 2.2.0?

i use this and i get "path.home is not configured" this type of error.
how to configured home path?
i also use 2.2.0 but still that not resolved.

That's strange. Actually this has been fixed months ago (in 2.0.0).

Here is my code:

        Settings settings = Settings.settingsBuilder()
                .put("", clusterName).build();

        Client client = TransportClient.builder().settings(settings).build()
                .addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("", 9300)))
                .addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("", 9301)));

I don't have to set anything else.

This message is more an error message when you try to start a Node from Java. May be you are doing integration tests or something?

1 Like